sudo curl http://npmjs.org/install.sh | sh #1641

Closed
alexhuang91 opened this Issue Nov 2, 2011 · 21 comments

Projects

None yet
@alexhuang91

All clean!
npm ERR! Could not create /usr/lib/node_modules/___npm.npm
npm ERR! error installing npm@1.0.103 Error: EACCES, Permission denied '/usr/lib/node_modules'
npm ERR! Error: EACCES, Permission denied '/usr/lib/node_modules'
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com
npm ERR!
npm ERR! System Linux 3.0.0-12-generic
npm ERR! command "/usr/bin/node" "/tmp/npm.29786/package/cli.js" "install" "-gf"
npm ERR! cwd /tmp/npm.29786/package
npm ERR! node -v v0.4.12
npm ERR! npm -v 1.0.103
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/npm.29786/package/npm-debug.log
npm not ok
It failed

@bobrik
Contributor
bobrik commented Nov 2, 2011

curl http://npmjs.org/install.sh | sudo sh

@devansh
devansh commented Nov 2, 2011

Hi, I am a newbie to node.js and have installing npm for the first time and having some trouble using the one line install.

when i use the :

curl http://npmjs.org/install.sh | sudo sh

I get nothing. (I mean the file is downloaded but then the prompt returns and npm is not installed)

and when i use:

curl http://npmjs.org/install.sh | sh    # without sudo

I get the error :

failed to get tarball url for npm/latest

Please advise .TIA

I don't know whether this is the right post to bring this up or not because there was another similar post but that was closed issue and I did not have permission to reopen it. If I am wrong please redirect me to the correct post.

@bobrik
Contributor
bobrik commented Nov 2, 2011

what about

sudo su
curl http://npmjs.org/install.sh | sh
@thejh
Contributor
thejh commented Nov 2, 2011

Try this:

npm_debug=1 curl http://npmjs.org/install.sh | sudo sh
@isaacs
Member
isaacs commented Nov 2, 2011

@thejh The npm_debug=1 needs to be on the sh, as well, and requires a bash/zsh capable interpreter.

curl http://npmjs.org/install.sh | sudo npm_debug=1 bash

@devansh What operating system are you seeing this no-output behavior on? A few people have reported similar results, and I can't seem to track it down. It always seems to work using bash in debug mode, so I'm guessing it's some kind of sh-related thing.

@isaacs isaacs closed this Nov 2, 2011
@devansh
devansh commented Nov 3, 2011

@bobrik
Using the command you suggest says : curl couldn't connect to host

@isaacs

  1. when I use the debug mode the sh file still stops on " Failed to get tarball url for npm/latest" .
  2. I am using ubuntu server 10.04 on a virtual machine hosted on Windows XP(If relevant, my network adaptor for the VM is NAT).
  3. I have also tried installing by cloning from the git but that too gives me the following error after I sudo make install :

Clone of 'https://github.com/isaacs/abbrev-js.git' into submodule path 'node_modules/abbrev' failed

4.I also followed your instructions in #1540 where in you have told to use the following command:

(curl -SsL -k https://registry.npmjs.org/npm/latest; echo "") | sed -e 's/^.*tarball":"//' | sed -e 's/".*$//' 

and i get the output as nothing. The prompt simply returns. I am at a loss on what to do. I need to install npm urgently. I thought of installing by downloading from tarball but the guy in issue#1540 had some issues with that too.But I guess I will give it a try too. TIA

@devansh
devansh commented Nov 3, 2011

@isaacs
I also tried installing by downloading the tarball from :http://registry.npmjs.org/npm/-/npm-1.0.96.tgz and then untar-ing it and then ./configure and sudo make install but I am having the same problem as issue#1540 (#1540)

@devansh
devansh commented Nov 4, 2011

does it have to do something with me using http:// instead of https:// because https:// does not install? It says curl couldn't connect.

And moreover using the s command for getting the url does get me : http://registry.npmjs.org/npm/-/npm-1.0.103.tgz when I use http:// instead of https://.

I guess I am right and also a complete novice if I understand it now that this might be a issue of my office network.

@isaacs
Member
isaacs commented Nov 5, 2011

@devansh I think you are correct, and that this is a network issue on your end. I'm not sure how to help you.

@snatesan

@isaacs, @devansh I guess this is because of SSL certificate verification failure. curl performs it by default. Using -k option will turn off curl's verification of the certificate

@devansh
devansh commented Nov 22, 2011

@snatesan
Yup, you are right. Had to set up proxy for https server too

@sandeepmeher

had an issue with the installation due to proxy settings, but managed by adding '-E' to the sudo command. 'sudo -E' allows the proxy environment variables set in the normal user mode.
curl http://npmjs.org/install.sh | sudo -E npm_debug=1 bash
... and i had to replace sh with bash (Ubuntu 11.10)

@mikermcneil

Hey guys, for posterity, now it's:

curl https://npmjs.org/install.sh | sudo sh

homeboy's using ssl

@mikermcneil

And by the way, in case this helps anyone else out: It's possible to get into a weird wormhole where you start getting ENOENT and lstat errors and stuff, particularly if you've been "using" (npm link that is). I'm no expert on any of this stuff, but if you delete your ~/.npm folder, it seems to do the trick.

@aclave1
aclave1 commented Dec 6, 2013

I get this same issue, I fixed it with:

 curl http://npmjs.org/install.sh -o install.sh 
 sudo chmod 777 install.sh
 sudo ./install.sh
@mehmetyaman

i'm getting same error
301 Moved Permanently
i tought that the page has been removed,

@isaacs
Member
isaacs commented Feb 22, 2014

The page hasn't been removed. It's been moved. Permanently.

Add -L to your curl command.

@BrandonMathis

Where has it been moved to?

@debashish216

Try this,,It will work..
sudo curl -k -L https://npmjs.org/install.sh | sudo sh

@ivan-kleshnin

I forgot how many times I runned npm update npm -g without sudo and got npm breaked because it unlinks everything at the beginning. So annoying.

@vkrishnasamy

Debashish. Thanks. I had the same issue.. it is simply moved and got it to work by this -L. Super.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment