3

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 ?

Uladz Kha
  • 2,154
  • 4
  • 40
  • 61
  • 1
    related: https://stackoverflow.com/questions/52499617/what-is-the-difference-between-npm-install-and-npm-ci/53325242#53325242 – Puka Jan 06 '22 at 08:02

1 Answers1

2

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

Puka
  • 1,485
  • 1
  • 14
  • 33