Вопрос

I'm trying to get a Rails 2.3 application working with Bundler/Torquebox on a Linux (Redhat) server. The application works correctly through JBoss, but won't let me start up a console. I get the following error when running jruby script/console:

Bundler could not find compatible versions for gem "torquebox-web":
  In snapshot (Gemfile.lock):
    torquebox-web (2.3.1)

  In Gemfile:
    torquebox (= 2.3.1) ruby depends on
      torquebox-web (= 2.3.1) ruby

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

When I run jruby -S bundle update it tells me it is using all the right versions of the gems, but the console still won't work.

I'm running Rails 2.3.18, Torquebox 2.3.1, and Bundler 1.3.5. Also worth noting is that this works correctly on my Windows development machine and on any Rails 3.2 applications (using jruby script/rails console). Any ideas what might be causing this?

Это было полезно?

Решение

jruby script/console apparently needs JRuby in the PATH to work correctly. If that isn't added to the PATH, that command will pick up the system Ruby (or whatever else might be in PATH).

To fix this, I was able to run the following commands:

export PATH=$JRUBY_HOME/bin:$PATH
jruby script/console

As Simon pointed out, using bundle exec before the jruby call is a good idea too:

bundle exec jruby script/console

If you don't want to run the export command every time, add that environment variable where you set all of your other environment variables.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top