how can I update to specific version of child dependency on a module

Viewed 25
1 Answers

I don't think you can do that easily with your current setup.

you can either update to npm v8.3+, which supports overrides or use yarn with resolutions

more info:

overrides(npm): https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

package.json

  "overrides": {
    "vue-tel-input": {
      "libphonenumber-js": "^1.10.12"
    }
  }

resolutions(yarn): https://classic.yarnpkg.com/en/docs/selective-version-resolutions/

package.json

  "resolutions": {
    "libphonenumber-js": "^1.10.12"
  }

alternatively, you can manage the package-lock.json file manually to define the version

"vue-tel-input": {
  "version": "5.11.0",
  "resolved": "https://registry.npmjs.org/vue-tel-input/-/vue-tel-input-5.11.0.tgz",
  "integrity": "sha512-kw13LdbnSH+Zk5Qb06vflG7Abu6QsM1cQyKvTA9T4kaZeARvyvKo9YZmziy7WiSuar932DWRjGI0SJnban4a2A==",
  "requires": {
    "core-js": "^3.14.0",
    "libphonenumber-js": "^1.9.6",
    "vue": "^2.6.14"
  }
},

you might be able to change "libphonenumber-js": "^1.9.6" to use ^1.10.12

but wanted to point out that when I did a fresh install, it did install 1.10.12

"node_modules/libphonenumber-js": {
  "version": "1.10.12",
  "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.12.tgz",
  "integrity": "sha512-xTFBs3ipFQNmjCUkDj6ZzRJvs97IyazFHBKWtrQrLiYs0Zk0GANob1hkMRlQUQXbJrpQGwnI+/yU4oyD4ohvpw=="
},

Because ^ will update to the latest minor version (2nd number), it should use a specific version, so in this case, because you're going from 1.9.* to 1.10.* and using ^1.9.6 you may be able to just remove your lock file and re-install to get 1.10.12

Related