今天对照着nodejs学习指南运行命令安装npm:curl http://npmjs.org/install.sh | sh
报错:
curl http://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 85 0 85 0 0 24 0 --:--:-- 0:00:03 --:--:-- 0
sh: line 1: syntax error near unexpected token `newline'
sh: line 1: `<html>Moved: <a href="https://npmjs.org/install.sh">https://npmjs.org/install.sh</a>'
解决办法:curl https://npmjs.org/install.sh | sh
Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7882 100 7882 0 0 7016 0 0:00:01 0:00:01 --:--:-- 7697k
tar=/bin/tar
version:
tar (GNU tar) 1.15.1
install npm@1.1
fetching: http://registry.npmjs.org/npm/-/npm-1.1.71.tgz
0.8.9
1.1.71
cleanup prefix=/usr/local
All clean!
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@1.1.71 /usr/local/lib/node_modules/npm
It worked
安装成功!