Home > Software design >  Why npm installation decrease dependencies versions
Why npm installation decrease dependencies versions

Time:01-06

I have a problem while installing package using npm it is decreasing dependencies versions that breaks my application and unit tests, for example my package.lock file fater instalation looks like: package.lock Please tell me how can I install package without decreasing dependencies versions ?

CodePudding user response:

You could try to use npm ci:

In short, the main differences between using npm install and npm ci are:

  • The project must have an existing package-lock.json or npm-shrinkwrap.json.
  • If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.
  • npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.
  • If a node_modules is already present, it will be automatically removed before npm ci begins its install.
  • It will never write to package.json or any of the package-locks: installs are essentially frozen.

https://docs.npmjs.com/cli/v6/commands/npm-ci

  •  Tags:  
  • Related