Ubuntu16.04安装最新版NodeJs以及Npm

转载地址:

https://www.jianshu.com/p/f2592d106aac

https://www.cnblogs.com/zycbloger/p/6210049.html


步骤:

1、先在系统上安装好nodejs和npm

sudo    apt-get    install    nodejs-legacy

sudo    apt-get    install    npm

2、安装用于安装nodejs的模块n

sudo    npm    install    -g    n

3、通过n模块安装指定的nodejs

sudo    n    latest

sudo    n    stable

sudo    n    lts

4、升级npm为最新版本

sudo    npm    install    npm@latest    -g

5、查看版本

sudo    node    -v

sudo    npm    -v

6、Npm更换为淘宝源

6.1 得到原本的镜像地址

npm get registry 

> https://registry.npmjs.org/

设成淘宝的

npm config set registry http://registry.npm.taobao.org/

6.2 换成原来的

npm config set registry https://registry.npmjs.org/



作者:WayD_ec7c
链接:https://www.jianshu.com/p/f2592d106aac
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

猜你喜欢

转载自blog.csdn.net/aishangyutian12/article/details/81048512