Ben Alan
Ben Alan

Reputation: 1695

Cannot install npm "removing existing npm failed!"

I get the same result if I try to install with curl or 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

Upvotes: 4

Views: 2408

Answers (1)

ramoliveira
ramoliveira

Reputation: 56

I had this same issue. Did some research and found the answer on npm Docs. I believe that this line solves the case:

sudo npm uninstall npm -g

You can read more here.

Upvotes: 2

Related Questions