1.查找nodejs的yum源

https://github.com/nodesource/distributions#rpminstall


 

2.下载node

curl -sL https://rpm.nodesource.com/setup_17.x | bash -

3.安装node

yum -y install nodejs

4.检查
通过:node -v 和 npm -v  查看版本


如上图说明安装成功

 
5.替换为淘宝NPM镜像
        5.1首先我们可以查看原本的镜像地址:

npm get registry

        5.2为了后续安装依赖速度更快将镜像替换成淘宝的:

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

        5.3如果想恢复原来的镜像地址:

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

        5.4可以用淘宝定制的cnpm工具来代替默认的npm:

npm install -g cnpm --registry=https://registry.npm.taobao.org
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐