質問

I'm trying to install Jruby on ROR for my application. Used commands from its documentation https://devcenter.heroku.com/articles/moving-an-existing-rails-app-to-run-on-jruby . While bundle installation got the following errors

  1. Your Ruby engine is ruby, but your Gemfile specified jruby
  2. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

Furthermore certain gems are not installed successfully, shows error like An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue. Make sure that gem install libv8 -v '3.16.14.3' succeeds before bundling.

Not able to find the issue. Would somebody help with this ?

Gemfile :

ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.9'
gem "rake"
gem "rails", "3.2.16"
gem 'foreigner'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'jruby'
gem 'airbrake'
gem "spreadsheet", "~> 0.9.0"
gem 'paperclip'
gem 'aws'
gem 'aws-sdk'
gem 'aws-s3', :require => nil
gem 'authlogic'
gem 'execjs'
gem 'mail', :require => nil
gem 'fastercsv', :require => nil
gem "rspec-rails"
gem 'rubyzip', :require => nil
gem 'test-unit'
gem 'typhoeus'
gem 'thin'
gem 'therubyracer'
gem 'useragent'
gem 'will_paginate'
gem 'therubyracer'
gem 'libv8', '3.16.14.3'
役に立ちましたか?

解決

You can't use 'therubyracer' and 'libv8' gems with JRuby.

Short answer:

Use 'therubyrhino' gem instead (https://github.com/cowboyd/therubyrhino)

Explanation:

There are some gems that can't be used under JRuby, because they are using native (C) extensions - here is a list: https://github.com/jruby/jruby/wiki/C-Extension-Alternatives

他のヒント

Make sure to install all below libraries, before installing Ruby/RVM.

sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev

Before JRuby installation.

sudo apt-get install ruby-dev
sudo apt-get install build-essential g++
rvm install jruby

Don't specify Jruby version, default you will get latest version.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top