我认为这是在Rails中安装therubyracer gem的常见问题。它是twitter-bootstrap-rails gem的依赖项。
我尝试过这样的解决方案: `gem install therubyracer` fails on Mac OS X Lion
以下是我的宝石文件的相关部分:
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修订版35410)[x86_64-darwin11.4.1] Mac OSX 10.7.4(狮子) Xcode 4.5
感谢您的帮助。
答案 0 :(得分:2)
我遇到了同样的问题,我通过安装libv8(gem install libv8
)解决了这个问题,然后安装了therubyracer。您需要首先安装Apple XCode(从App Store安装),因为这包括构建libv8所需的c编译器。