“npm install”和“npm ci”有什么区别

5 min read
  • The project must have an existing package-lock.json or npm-shrinkwrap.json.
    该项目必须具有现有的 package-lock.json 或 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.
    如果包锁中的依赖项与 package.json 中的依赖项不匹配,npm ci 将退出并显示错误,而不是更新包锁。
  • npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.
    npm ci 一次只能安装整个项目:不能使用此命令添加单个依赖项。
  • If a node_modules is already present, it will be automatically removed before npm ci begins its install.
    如果node_modules已存在,则会在 npm ci 开始安装之前自动将其删除。
  • It will never write to package.json or any of the package-locks: installs are essentially frozen.
    它永远不会写入package.json或任何软件包锁:安装基本上是冻结的。