首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法将npm从6.14.8更新到7.3;删除npm.cmd、npx.cmd和npm会导致更多错误

无法将npm从6.14.8更新到7.3;删除npm.cmd、npx.cmd和npm会导致更多错误
EN

Stack Overflow用户
提问于 2021-01-05 16:44:32
回答 1查看 1.8K关注 0票数 2

我一直在尝试使用Git中的npm install -g npm命令来全面更新我的npm,以使其与角11和Node.js版本15.5.0保持一致。我收到以下错误:

代码语言:javascript
运行
复制
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npm.cmd
npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

我删除了nodejs中的文件,并试图再次安装,但是收到了另一个关于npx.cmd的错误。我删除了该文件,尝试安装,并收到了一个关于npm文件的错误。

代码语言:javascript
运行
复制
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npx.cmd
npm ERR! Refusing to delete C:\Program Files\nodejs\npx.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npx.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
代码语言:javascript
运行
复制
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npm
npm ERR! Refusing to delete C:\Program Files\nodejs\npm: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

在删除它们并再次尝试安装npm之后,Git不再找到npm。安装从未开始。

代码语言:javascript
运行
复制
bash: /c/Program Files/nodejs/npm: No such file or directory

我试图从AppData中的漫游文件夹中删除npm文件,但收到以下错误:

代码语言:javascript
运行
复制
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\Yoga 2 Mitchell\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\Yoga 2 Mitchell\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

我还在不同的时间尝试了以下几种方法:

  • 删除node_modules并重新安装npm
  • 使用NPM7.3.0的Git存储库创建一个新的npm文件(?)(我需要在网上再次找到这个建议,以澄清/提供更多的specifics)
  • Clean caches
  • Uninstall和重新安装角11 CLI和Node.js (为LTS和当前版本尝试)

到目前为止,一切都不起作用。我在上面的列表中尝试过的第二种方法能够将其更新为6.14.10,但是这个尝试返回了似乎影响角度的错误。为了安全起见,我把一切都恢复到原来的状态。请让我知道,如果我能澄清任何关于我的问题。

EN

回答 1

Stack Overflow用户

发布于 2021-01-23 05:30:19

我和另一个开发人员联系上了我收到的错误。建议了以下方法,它可以解决LTS:How to completely remove node.js from Windows的问题。

LTS版本允许我更新到npm的6.14.11,但当我尝试安装当前版本时,它保留了6.14.11。希望这种方法能帮助其他正在经历类似错误的人。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65583066

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档