gpt4 book ai didi

javascript - 为什么 npm 安装会降低依赖版本

转载 作者:行者123 更新时间:2023-12-05 04:38:31 30 4
gpt4 key购买 nike

我在使用 npm 安装包时遇到问题它正在减少破坏我的应用程序和单元测试的依赖版本,例如我的 package.lock 文件安装后看起来像: package.lock请告诉我如何在不降低依赖项版本的情况下安装包?

最佳答案

你可以尝试使用 npm ci:

In short, 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.

https://docs.npmjs.com/cli/v6/commands/npm-ci

关于javascript - 为什么 npm 安装会降低依赖版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70589530/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com