npm 安装
1.安装brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.删除node文件,完全卸载node和npm
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
或
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node*/usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node/opt/local/lib/node_modules
3.通过brew安装node和npm
brew link node
brew uninstall node
brew install node
https://www.runoob.com/nodejs/nodejs-install-setup.html
(一).安装包或者源码安装
https://nodejs.org/en/download/
(二).Node.js 源码安装
在 Github 上获取 Node.js 源码:sudo git clone https://github.com/nodejs/node.git
sudo chmod -R 755 node
./configure 创建编译:
cd node
sudo ./configure
sudo make
sudo make install
查看 node 版本 node --version
(三)Ubuntu apt-get命令安装
sudo apt-get install nodejs
sudo apt-get install npm
网友评论