mac下安装npm
Homebrew简称brew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件。
1.打开终端,执行以下命令安装Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
执行上面命令后会提示输入系统密码,输入密码继续安装。
2.如安装成功则会看到:Installation successful!
3.此时可以在命令行中输入命令brew进行测试,可以看到如下结果,说明安装成功。
Example usage: brew search [TEXT|/REGEX/] brew (info|home|options) [FORMULA...] brew install FORMULA... brew update brew upgrade [FORMULA...] brew uninstall FORMULA... brew list [FORMULA...] Troubleshooting: brew config brew doctor brew install -vd FORMULA Developers: brew create [URL [--no-fetch]] brew edit [FORMULA...] http://docs.brew.sh/Formula-Cookbook.html Further help: man brew brew help [COMMAND] brew home
4.接下来就可以执行以下命令,安装我们需要的node了
brew install node 执行以下命令查看是否安装成功 node -v:查看node版本 npm -v:查看npm版本