标签:淘宝 content his 它的 oba nod 著作权 最新版 sele
http://bubkoo.com/2017/01/08/quick-tip-multiple-versions-node-nvm/
作为前端开发者,node和npm安装必不可少。然而有时会因为安装新的app(如MacPorts,慎装,它会修改基本环境变量以及npm的全局设置等)导致版本环境混乱,有2种方式有效管理:
目前我更多的使用nvm来进行node版本管理,它会安装相应版本的npm。
执行如下命令:
curl -L -o- [http://build.sankuai.com/nvm/install](http://build.sankuai.com/nvm/install) | bash
上述失败了的话试试这个:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
nvm install v8.5.0
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
npm --registry=https://registry.npm.taobao.org
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update
$ brew doctor
Warning: Some directories in /usr/local/share/man aren‘t writable.
This can happen if you "sudo make install" software that isn‘t managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.You should probably
sudo chown -R $(whoami)
them:
/usr/local/share/man/man5
/usr/local/share/man/man7
export PATH="/usr/local/bin:$PATH"
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Runbrew link
on these:
node
则需要如下操作:
$ brew cleanup
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
或者是下面这样:
1.在/usr/local/lib目录下,删除任何与node和 node_modules有关的目录;
2.在/usr/local/include 目录下,删除任何与node 和 node_modules有关的目录;
3.如果你是通过**brew install node**安装的node,则在终端执行**brew uninstall node** ,并在home目录下查找 **local** 或**lib** 或 **include**文件夹,删除任何与**node** 和 **node_modules**有关的目录;
4.在**/usr/local/bin**目录下,删除任何与 **node** 执行文件;
5.最后下载 **nvm** ,跟随它的介绍安装node。当然,你也可以通过**npm**来安装最新版本的Node。
brew link node
brew uninstall node
brew install node
npm install -g grunt-cli
标签:淘宝 content his 它的 oba nod 著作权 最新版 sele
原文地址:https://www.cnblogs.com/shangxiaofei/p/9384962.html