Ubuntu14安装node.js及npm

应为需要用到npm所以想在Ubuntu服务器上装node.js

然而使用wegt命令下载官网上的最新版失败,提示没有文件,不知为啥

于是下载Ubuntu自带的node.js,但是版本太低

sudo apt install nodejs-legacy
sudo apt install npm


升级nodejs版本,官网上的解决方式

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 6.x on older distros.

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Alternatively, for Node.js 8:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

升级npm版本
sudo npm install npm@latest -g


最后node为8.5.0最新版。npm为5点几的版本
以上
posted on 2017-09-24 17:20  bettyjones  阅读(564)  评论(0编辑  收藏  举报