Ubuntu/Centos 安装nodejs和npm

2017-11-28  本文已影响0人  JoJo_wen

Ubuntu

  1. update
 sudo apt-get  update    
  1. install nodejs
sudo apt-get  install  nodejs

using node -v to check whether install successfully or not.

  1. install npm
sudo apt-get  install  npm

using npm -v to check.


if you not excute 1. command, you will get this error when you install npm. (just run apt-get update to solve it. )

Do you want to continue? [Y/n] y
Err:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main i386 libssl-dev i386 1.0.2g-1ubuntu4.8
  404  Not Found
Err:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main i386 libssl-doc all 1.0.2g-1ubuntu4.8
  404  Not Found
Unable to correct missing packages.
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/o/openssl/libssl-dev_1.0.2g-1ubuntu4.8_i386.deb  404  Not Found

E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/o/openssl/libssl-doc_1.0.2g-1ubuntu4.8_all.deb  404  Not Found

E: Aborting install.

Centos

yum -y install nodejs npm --enablerepo=epel

Sometimes, you may find npm slow, try cnpm:

npm install -g cnpm --registry=https://registry.npm.taobao.org
上一篇 下一篇

猜你喜欢

热点阅读