1

I'm using package foo that has "bar": "^1.0.0" in it's dependencies.

I want to force my package foo to use the fixed version"bar": "1.0.0", because the latest patched version of bar is broken.

Is there a way to do this ?

Or do I have no choice but to fork foo library with "bar": "1.0.0" specified.

RobC
  • 22,977
  • 20
  • 73
  • 80
Lev
  • 13,856
  • 14
  • 52
  • 84
  • May this help? https://stackoverflow.com/questions/15806152/how-do-i-override-nested-npm-dependency-versions I do not mark it as duplicated, because I don't know if forcing version is only for you (local) or in case you're developping `foo` with other underlying dependencies that require `bar` – Sergio Jul 15 '20 at 09:22

1 Answers1

0

npm force resolution can do the trick...

install npm force resulution

npm install --save-dev npm-force-resolutions

modify package.json

"scripts": {
  "preinstall": "npx npm-force-resolutions"
},
"resolutions": {
  "bar": "1.0.0"
}

then run npm install

Mr.
  • 9,429
  • 13
  • 58
  • 82