Ubuntu/Centos 安装nodejs和npm

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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容