安装therubyracer时出错

时间:2012-12-09 11:15:15

标签: ruby-on-rails ruby-on-rails-3 therubyracer

我在捆绑安装我的更新时收到错误。这是我的gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'
gem 'libv8'
gem 'therubyracer'
gem 'haml'
gem 'haml-rails'
gem 'sass-rails',   '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'compass-rails'
gem 'chosen-rails'
gem "bootstrap-wysihtml5-rails", "~> 0.3.1.10"
gem 'hpricot'
gem "rest-open-uri", "~> 1.0.0"
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'

# Gems used only for assets and not required
# in production environments by default.
group :assets do

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer'

  gem 'uglifier', '>= 1.0.3'
  gem "commonjs", "~> 0.2.6"
  gem "less", "~> 2.2.2"
  gem "less-rails", "~> 2.2.6"
end


gem 'jquery-rails'
gem 'simple_form'
gem 'client_side_validations'
gem 'client_side_validations-simple_form'

# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

以下是在生产中运行bundle install命令后出现的错误:

  

安装therubyracer(0.11.0)和Bundler时发生错误   无法继续。确保gem install therubyracer -v '0.11.0'   在捆绑之前成功。

5 个答案:

答案 0 :(得分:7)

我做了以下对我有用的事情:

  • 我从我的Gemfile中注释掉了therubyracer
  • 跑“捆绑安装”
  • 使用“gem install therubyracer”安装了最新版本的therubyracer(在撰写本文时为0.11.2)
  • 我取消注释了therubyracer将它重新放回我的Gemfile
  • 再次运行“捆绑安装”,一切正常

答案 1 :(得分:4)

libv8中包含Gemfile似乎是对此的修复:

gem 'libv8', '~> 3.11.8.3'

通过https://github.com/cowboyd/therubyracer/issues/215

答案 2 :(得分:2)

我做了一个宝石卸载therubyracer& gem卸载libv8,然后从gemfile中删除libv8并只使用therubyracer,然后运行'bundle install'

答案 3 :(得分:1)

group :assets do
  gem 'therubyracer'
end

如果仍然无效,请尝试安装NodeJS

答案 4 :(得分:0)

可能,您的libv8版本和therubyracer版本不匹配。

所以,要么你可以在Gemfile中包含适当的libv8版本,这类似于 jibiel的解决方案

gem 'libv8', '~> 3.11.8.3'

但是,我更愿意做这两个步骤,所以,你不必担心找到正确版本的libv8:

Gemfile

gem 'therubyracer'

terminal

gem uninstall libv8
bundle install

而且,这就是我为解决同样问题所做的工作