我一直在尝试使用Git中的npm install -g npm
命令来全面更新我的npm,以使其与角11和Node.js版本15.5.0保持一致。我收到以下错误:
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文件的错误。
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.
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。安装从未开始。
bash: /c/Program Files/nodejs/npm: No such file or directory
我试图从AppData
中的漫游文件夹中删除npm文件,但收到以下错误:
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 npm
文件(?)(我需要在网上再次找到这个建议,以澄清/提供更多的specifics)。
到目前为止,一切都不起作用。我在上面的列表中尝试过的第二种方法能够将其更新为6.14.10,但是这个尝试返回了似乎影响角度的错误。为了安全起见,我把一切都恢复到原来的状态。请让我知道,如果我能澄清任何关于我的问题。
发布于 2021-01-23 05:30:19
我和另一个开发人员联系上了我收到的错误。建议了以下方法,它可以解决LTS:How to completely remove node.js from Windows的问题。
LTS版本允许我更新到npm的6.14.11,但当我尝试安装当前版本时,它保留了6.14.11。希望这种方法能帮助其他正在经历类似错误的人。
https://stackoverflow.com/questions/65583066
复制相似问题