Installing NPM on AWS EC2


Question

Working on Ec2 on AWS.

I have installed Node.js and it works fine.

But the problem arises when trying to install npm.

I am using the following command to install it:

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

But the install seems to freeze... I get "fetching: http://registry.npmjs.org/npm/-/npm-1.0.106.tgz" at the prompt and it stays on like this.

Have any idea what is going on here?

1
44
11/20/2011 10:43:49 PM

Accepted Answer

sudo yum install nodejs npm --enablerepo=epel
115
2/11/2014 7:05:47 PM

To install NodeJS 6.x execute the following commands:

curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
yum install nodejs --enablerepo=nodesource

Update

You can install NodeJS 7 and 8 in the same way. Just specify the version you need instead of 6 in the command above.

Update

To update to NodeJS 10 (or any other version) do the following:

rm -rf /etc/yum.repos.d/nodesource-el*
curl -sL https://rpm.nodesource.com/setup_10.x | sudo -E bash -
yum install nodejs --enablerepo=nodesource

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon