Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm ci 与 install 的区别 #220

Open
wayou opened this issue Aug 26, 2020 · 0 comments
Open

npm ci 与 install 的区别 #220

wayou opened this issue Aug 26, 2020 · 0 comments

Comments

@wayou
Copy link
Owner

@wayou wayou commented Aug 26, 2020

npm ci 与 install 的区别

  • 要求必需有 package-lock.json 或 npm-shrinkwrap.json 文件存在
  • 如果 lock 与 package.json 中版本不匹配,直接报错中断,而不是更新 lock 文件
  • npm ci 不能用来安装单个依赖,只能用来安装整个项目的依赖
  • npm ci 会检测如果 node_modules 已经存在,则先删除再进行安装操作
  • npm ci 会安装 dependenciesdevDependencies,
    • 和 npm install 一样,生产环境下,即通过 -—production 或通过 NODE_ENV 配置,则只会安装 dependencies
  • 不会更新 package.jsonpackage-lock.json 文件,整个安装过程是锁死的
  • 缓存 npm ci --cache .npm
  • npm ci 时建议加上 --quiet --no-progress 关闭进度和其他无用 log,否则产生的日志会很大。
  • 所以 ci 时推荐完整的命令为 npm ci --cache .npm --quiet --no-progress

相关资源

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.