在AWS EC2上安装NPM
在AWS上处理Ec2。在AWS EC2上安装NPM
我已经安装Node.js,它工作正常。
但试图安装npm时出现问题。
我使用下面的命令来安装它:
sudo curl http://npmjs.org/install.sh | sh
但安装似乎停止了...... 我得到“获取:http://registry.npmjs.org/npm/-/npm-1.0.106.tgz”的提示,它停留在这样的。
有什么想法这里发生了什么?
sudo yum install nodejs npm --enablerepo=epel
这个问题既没有统计正在运行的操作系统,也没有,如果CentOS/RHEL,哪个版本,或者EPEL回购安装。例如,NodeJS和NPM不在RHEL5 EPEL库中。 – Charles
这是由于长度自动标记,请认真加一点解释。 – 2014-02-11 18:36:11
谢谢,工作就像一个魅力! –
编辑我的答案是不恰当了:
尝试:
curl --silent --location https://rpm.nodesource.com/setup | bash -
yum -y install nodejs
仅供参考,'nodejs.tchol.org'链接现在已被打破(任何人在一年后到此为止)。 – lollercoaster
过时,不再列在给出的页面上。 – Air
我发现他的教程已经非常有用的对我说:最后一章介绍了如何安装节点和npm编译它。
http://iconof.com/blog/how-to-install-setup-node-js-on-amazon-aws-ec2-complete-guide/#installNode
git clone https://github.com/isaacs/npm.git cd npm sudo make install
如果你没有git的,这样做第一: sudo yum install git
要安装6.x的的NodeJS执行以下命令:
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
yum install nodejs --enablerepo=nodesource
更新
您可以用同样的方法安装NodeJS 7和8。只需在上面的命令中指定您需要的版本而不是6。
现在这是正确的答案! – f1lt3r
我如何卸载6并安装7?如果我已经安装6这种方式? –
按照此AWS Tutorial使用Node Version Manager。
节点版本管理器(NVM)允许您安装多个版本的Node.js并在它们之间切换。
步骤如下:
安装NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
激活NVM
. ~/.nvm/nvm.sh
安装节点(选择版本)
nvm install 4.4.5
确认成功安装
node -e "console.log('Running Node.js ' + process.version)"
有时注册表下跌。看看这个页面:http://npmjs.org/doc/faq.html – malletjo
尝试node.js的v 0.4.12 类似的问题 http://*.com/questions/8117446/node-。 js-0-4-12-dont-work-correct-on-aws-ec2-why – Bart