简体   繁体   English

无法安装 npm “删除现有 npm 失败!”

[英]Cannot install npm "removing existing npm failed!"

I get the same result if I try to install with curl or sh install如果我尝试使用 curl 或 sh install 安装,我会得到相同的结果

$curl -L https://www.npmjs.com/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  
Current
                                 Dload  Upload   Total   Spent    Left  
Speed
100  3755  100  3755    0     0  35424      0 --:--:-- --:--:-- --:--:-- 35424
fetching: https://registry.npmjs.org/npm/-/npm-6.14.8.tgz
removing existing npm
failed!

sh install安装

$sh install.sh
fetching: https://registry.npmjs.org/npm/-/npm-6.14.8.tgz
removing existing npm
failed!

as you can see it's not installed如您所见,它没有安装

$npm -version
bash: /usr/bin/npm: /usr/bin/nodejs: bad interpreter: No such file or 
directory

$ node -v
v16.0.0-pre

I had this same issue.我有同样的问题。 Did some research and found the answer on npm Docs.做了一些研究并在 npm Docs 上找到了答案。 I believe that this line solves the case:我相信这条线解决了这个问题:

sudo npm uninstall npm -g

You can read more here .你可以在这里阅读更多。

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

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