1

npm version: 7.24.2

someone know update a child dependency, I have the dependency:

  • vue-tel-input

and this dependency has the dependency libphonenumber-js with version: ^1.9.6

I want to update this libphonenumber-js to ^1.10.12 I already tried with:

any idea?

1 Answers1

0

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

Daniel
  • 34,125
  • 17
  • 102
  • 150
  • yep, but the condition of the project dont let me to update to npm v8+ – Fauricio Valencia Aug 15 '22 at 22:52
  • you can also edit the `package.lock` manually – Daniel Aug 15 '22 at 22:58
  • but the current library, that in this case is `vue-tel-input`, doesnt have the last version of `libphonenumber-js` – Fauricio Valencia Aug 15 '22 at 23:02
  • looks like `libphonenumber-js` will install with v `1.10.12`, so you could try removing the lock file and doing `npm i` to re-install. If the version or locks are cached in ci/cd pipeline, you might need to clear the cache. – Daniel Aug 15 '22 at 23:06
  • something weird, I just to run `npm cache clean -f` and also I re run `npm i` but I still getting the same problem with the library. but also, something interesting, I just did a test to update the version of `npm` to `8+` with json of `overrides` and even, I still gettin the problem with the version of `libphonenumber-js` – Fauricio Valencia Aug 16 '22 at 00:06
  • can you clarify what that problem is? maybe the library version installed is fine‍♂️ – Daniel Aug 16 '22 at 01:37