简体   繁体   English

安装therubyracer时出错

[英]Getting error while installing therubyracer

I am receiving an error while bundle install my updates. 捆绑安装我的更新时收到错误。 Here is my gemfile: 这是我的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'

Here is an error i am getting after running bundle install command on production: 这是在生产中运行bundle install命令后得到的错误:

An error occured while installing therubyracer (0.11.0), and Bundler cannot continue. 安装therubyracer(0.11.0)时发生错误,Bundler无法继续。 Make sure that gem install therubyracer -v '0.11.0' succeeds before bundling. 在捆绑之前确保gem install therubyracer -v '0.11.0'成功。

I did the following that worked for me: 我做了以下对我有用的事情:

  • I commented out therubyracer from my Gemfile 我从我的Gemfile中注释掉了therubyracer
  • ran "bundle install" 跑了“捆绑安装”
  • installed the newest version of therubyracer using "gem install therubyracer" (at the time of writing this is 0.11.2) 使用“gem install therubyracer”安装最新版本的therubyracer(在撰写本文时为0.11.2)
  • I uncommented therubyracer to put it back in to my Gemfile 我取消注释了therubyracer,把它放回我的Gemfile中
  • ran "bundle install" again and everything works 再次运行“捆绑安装”,一切正常

Including libv8 in the Gemfile seems to be a fix to that: 包括libv8Gemfile似乎是一个修复程序是:

gem 'libv8', '~> 3.11.8.3'

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

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

group :assets do
  gem 'therubyracer'
end

If it still does not work, just try to intall NodeJS 如果它仍然不起作用,只需尝试安装NodeJS

probably, your libv8 version and therubyracer version are not matching. 可能,你的libv8版本和therubyracer版本不匹配。

So, either you can include proper libv8 version in the Gemfile, which is similar to the jibiel's solution 因此,您可以在Gemfile中包含适当的libv8版本,这与jibiel的解决方案类似

gem 'libv8', '~> 3.11.8.3'

But, I would prefer to do these two steps, So, that you don't have to worry about finding proper version of libv8: 但是,我更愿意这两个步骤,所以,你不必担心找到正确版本的libv8:

Gemfile

gem 'therubyracer'

terminal

gem uninstall libv8
bundle install

And, that is what I have done to solve my same problem 而且,这就是我为解决同样问题所做的工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM