npm5 相当于 yarn 的 --pure-lockfile 标志? [英] npm5 equivalent to yarn's --pure-lockfile flag?
本文介绍了npm5 相当于 yarn 的 --pure-lockfile 标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找纱线的等效项 --pure-lockfile
标志.
I'm looking for an equivalent for yarn's --pure-lockfile
flag.
这个标志在 CI 中安装依赖项时很有用,当你希望它读取你的锁文件但不修改它时.
This flag is useful when installing dependencies in CI, when you want it to read your lockfile but not modify it.
npm v5 有等价的吗?
Does npm v5 have an equivalent?
推荐答案
npm 5.7 引入了 npm ci
子命令:
npm 5.7 introduced the npm ci
subcommand:
使用 npm install
和 npm ci
的主要区别是:
the main differences between using
npm install
andnpm ci
are:
- 项目必须有一个现有的
package-lock.json
或npm-shrinkwrap.json
. - 如果包锁中的依赖项与
package.json
中的依赖项不匹配,npm ci
将退出并报错,而不是更新包锁. npm ci
一次只能安装整个项目:无法使用此命令添加单个依赖项.- 如果
node_modules
已经存在,它将在npm ci
开始安装之前自动删除. - 它永远不会写入
package.json
或任何包锁:安装基本上是冻结的.
- 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 标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文