我正在尝试使用
在Mac v 10.12.2中安装Homebrewbrew install node
但我收到了这些错误:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:15:in `<main>'
答案 0 :(得分:2)
1 - 首先,安装Homebrew。
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2 - 然后运行brew更新以确保Homebrew是最新的。
brew update
3 - 作为一种安全措施,您应该运行brew医生以确保您的系统已准备好冲泡。运行以下命令并遵循brew doctor的任何建议。
brew doctor
4 - 接下来,将Homebrew的位置添加到.bash_profile或.zshrc文件中的$ PATH。
export PATH="/usr/local/bin:$PATH"
5 - 接下来,安装Node(npm将与Node一起安装):
brew install node
6 - 要测试你的Node和npm install,请尝试安装Grunt(可能会要求你运行sudo):
npm install -g grunt-cli