繁体   English   中英

将我的 npm 从版本 6 升级到版本 7(节点版本为 10)后,我无法为某些项目安装依赖项

[英]After Upgrading my npm from version 6 to version 7 (node version was 10) I cant install dependencies for some projects

我在我的系统中安装了节点版本 10,在将我的 npm 从版本 6 升级到版本 7 之后,我无法安装依赖项,并且出现错误,所以我不得不将我的节点降级到 6,( npm cinpm i失败了)我正在测试的项目是这样的:

https://github.com/Giveth/feathers-giveth

错误是这样的:

npm ERR! code 128
npm ERR! git dep preparation failed
npm ERR! command /Users/username/.nvm/versions/node/v10.23.0/bin/node /Users/username/.nvm/versions/node/v10.23.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/username/.npm/_cacache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 128
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command git clone --mirror -q ssh://git@github.com/gulpjs/gulp.git /Users/renjer/.npm/_cacache/_cacache/tmp/git-clone-dfb83c15/.git
npm ERR! npm ERR! fatal: destination path '/Users/username/.npm/_cacache/_cacache/tmp/git-clone-dfb83c15/.git' already exists and is not an empty directory.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/username/.npm/_cacache/_logs/2021-02-18T16_18_35_855Z-debug.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/username/.npm/_logs/2021-02-18T16_20_15_536Z-debug.log

这个问题一般是因为如果你只升级系统的node版本,有一些包和依赖是按照那个版本安装的。

这是一个手动过程,但您必须根据该版本安装 package。

例如 (package.json):在您的节点 6 版本中,您有一些 package:

"xyz":^1.2.3

已安装 package 及其与节点 6 一起使用的依赖项,从您的 package.json 中手动删除 package 并像手动安装一样

npm install xyz

然后您可能会注意到版本升级,例如:

"xyz":^4.5.6

对你的每个包裹都这样做,你的问题可能就会消失。 这就是我用来解决该问题的方法。

您还可以将所有软件包升级到其最新版本,但是...如果您有很多软件包并且有人不工作,您将不知道哪个失败了,您将单独检查它。

也许(在写这个答案的时候)如果你使用的是 Node 10,最新的软件包版本也不会工作,因为该版本可以修复以与 Node 16(目前的 LTS(长期支持)版本)一起使用写这个答案)。

如果您还没有这样做,我建议您不断将您的系统升级到某个未弃用的 LTS 版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM