最佳答案
npm 5.7 引入了 npm ci
子命令:
the main differences between using
npm install
andnpm ci
are:
- The project must have an existing
package-lock.json
ornpm-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 beforenpm ci
begins its install.- It will never write to
package.json
or any of the package-locks: installs are essentially frozen.
关于npm5 相当于yarn 的 --pure-lockfile 标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44800747/