在 ~/.bashrc 中添加:
在终端中输入:
npm install express -gd
(一定要使用参数gd,否则将会将express安装于当前目录)
然后是漫长的等待,,,,,,
尼玛,换用淘宝源
vim ~/.bashrc(如果没有权限的的话就使用su命令切换到root账户)
在文件末尾添加:
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
执行:
source ~/.bashrc
将设置立即生效
然后在安装express
cnpm install express -gd
秒装
O了!