npm5 相当于yarn 的 --pure-lockfile 标志?

标签 npm package-lock.json

我正在寻找 yarn --pure-lockfile flag 的等效项.

当您希望它读取锁定文件但不修改它时,在 CI 中安装依赖项时,此标志非常有用。

npm v5 有等效的吗?

最佳答案

npm 5.7 引入了 npm ci 子命令:

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.

关于npm5 相当于yarn 的 --pure-lockfile 标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44800747/

相关文章:

node.js - 找不到 ionic './ber/index' 模块

Node.js:使用 IPC 在主 Node 和工作 Node 之间进行请求/响应

node.js - npm install 更改从 URL 解析为 false

json - 如何防止 git 为 JSON 文件生成错误的差异?

node.js - package-lock.json 中的 "requires: true"有什么作用

node.js - 如何将 Node 模块安装在与node_modules不同的文件夹下?

node.js - 如何在没有互联网的情况下(离线)安装最新版本的 Typescript?

mysql - 使用未知数据类型 FLOAT

github - 修复 package-lock.json 中定义的依赖项中潜在安全漏洞的正确方法

node.js - 为什么 "npm install"会修改package-lock.json?那为什么要提交给 git 呢?