centOS 通過yum 安裝nodejs和npm


官方查看有哪些版本,查找自己想要的nodejs源

https://github.com/nodesource/distributions

 

 

 

比如我安裝14.x

 

 

先安裝源:

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

 

 

然后:

yum -y install nodejs

通過:node -v  和npm -v 查看版本,說明安裝成功

 

替換為淘寶NPM鏡像

首先我們可以查看原本的鏡像地址:

npm get registry
https://registry.npmjs.org/

然后替換成淘寶的:

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

如果想恢復原來的鏡像地址:

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

如果用淘寶定制的cnpm工具來代替默認的npm:

 

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM