我认为这是在 Rails 中安装 therubyracer gem 的常见问题。它是 twitter-bootstrap-rails gem 的依赖项。
我试过这样的解决方案: `gem install therubyracer` 在 Mac OS X Lion 上失败
这是我的 gem 文件中相关的部分:
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'twitter-bootstrap-rails'
end
这是我在运行 bundle install 时遇到的错误:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/lionel_lei/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for main() in -lobjc... yes
creating Makefile
make
compiling rr.cpp
make: clang++: No such file or directory
make: *** [rr.o] Error 1
Gem files will remain installed in /Users/lionel_lei/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.10.2 for inspection.
Results logged to /Users/lionel_lei/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.10.2/ext/v8/gem_make.out
An error occured while installing therubyracer (0.10.2), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.10.2'` succeeds before bundling.
我的系统环境是:Rails 3.2.6 ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.1] Mac OSX 10.7.4 (lion) Xcode 4.5
- 我一直在拔头发。我是 ruby/rails 的新手,哎呀,我通常是编码新手,所以错误消息对我来说没有多大意义。我猜这是某种编译器问题。
谢谢你的帮助。