Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm5 equivalent to yarn's --pure-lockfile flag?

Tags:

I'm looking for an equivalent for yarn's --pure-lockfile flag.

This flag is useful when installing dependencies in CI, when you want it to read your lockfile but not modify it.

Does npm v5 have an equivalent?

like image 662
callum Avatar asked Jun 28 '17 11:06

callum


People also ask

What does -- frozen lockfile do for yarn?

Lock files ensure that the defined dependencies from files such as package. json get pinned to specific versions. This later ensures parity on developers' workstations, CI, and production. Many people probably depend on Yarn doing the right thing and installing only the pinned versions from yarn.

How do I sync yarn lock and package-lock json?

Simply install syncyarnlock, and execute with the options applicable to your needs. For example, to sync a project's package. json with the project's yarn. lock, and have the ranges remain intact while updating the versions to reflect what will actually be installed, simply run: syncyarnlock -s -k .

Can you change package-lock json?

The `package-lock. json` file was introduced in npm version 5 to solve this problem. It is a generated file and is not designed to be manually edited.

What is npm lockfile?

What's a Lock FileLock FileFile locking is a mechanism that restricts access to a computer file, or to a region of a file, by allowing only one user or process to modify or delete it at a specific time and to prevent reading of the file while it's being modified or deleted.https://en.wikipedia.org › wiki › File_lockingFile locking - Wikipedia? A lock file describes the entire dependency tree as it is resolved when created including nested dependencies with specific versions. In npm these are called package-lock. json and in yarn they are called yarn. lock .


1 Answers

npm 5.7 introduced the npm ci subcommand:

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.
like image 145
Tamlyn Avatar answered Oct 20 '22 04:10

Tamlyn