CentOS 7 安装 Nodejs npm

npm 与 nodejs 有什么关系?

安装 npm 其实就是安装 nodejs 的过程,npm 依赖于 nodejs 环境中,安装完 nodejs ,npm 也就安装好了。


1.安装 nodejs  [官方介绍请看这里:https://github.com/nodesource/distributions]        

curl -sL https://rpm.nodesource.com/setup_6.x  |  bash  -  
yum install -y nodejs

2.如果提示你需要安装构建工具 gcc gcc++ 什么的你就安装就行了,安装完了再重新安装 nodejs

命令:node -v 如果输出版本号就安装成功了。 


3. 更新 npm 

npm install npm@latest -g

命令:npm -v 输出版本号就成功安装了。


猜你喜欢

转载自blog.csdn.net/qq292913477/article/details/80703529