Ruby on rails 捆绑机可以';运行脚本/控制台时找不到torquebox web gem
我正在尝试让一个Rails 2.3应用程序在Linux(Redhat)服务器上使用Bundler/Torquebox。该应用程序通过JBoss正常工作,但不允许我启动控制台。我在运行jruby脚本/控制台时遇到以下错误:Ruby on rails 捆绑机可以';运行脚本/控制台时找不到torquebox web gem,ruby-on-rails,bundler,torquebox,Ruby On Rails,Bundler,Torquebox,我正在尝试让一个Rails 2.3应用程序在Linux(Redhat)服务器上使用Bundler/Torquebox。该应用程序通过JBoss正常工作,但不允许我启动控制台。我在运行jruby脚本/控制台时遇到以下错误: Bundler could not find compatible versions for gem "torquebox-web": In snapshot (Gemfile.lock): torquebox-web (2.3.1) In Gemfile:
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.
当我运行jruby-S bundle update
时,它告诉我它正在使用所有正确版本的gems,但控制台仍然无法工作
我正在运行Rails 2.3.18、Torquebox 2.3.1和Bundler 1.3.5。另外值得注意的是,这在我的Windows开发机器和任何Rails 3.2应用程序上都能正常工作(使用
jruby脚本/Rails控制台)。你知道这是什么原因吗?jruby脚本/控制台
显然需要jruby在路径
中才能正常工作。如果未将其添加到路径
,则该命令将拾取系统Ruby(或路径
中的任何其他内容)
要解决此问题,我可以运行以下命令:
export PATH=$JRUBY_HOME/bin:$PATH
jruby script/console
正如Simon指出的,在调用jruby
之前使用bundle exec
也是一个好主意:
bundle exec jruby script/console
如果您不想每次都运行export
命令,请在设置所有其他环境变量的位置添加该环境变量。您是否尝试过bundle exec jruby script/rails console
@Simon好主意;我没有想到这一点,但不幸的是,这也有同样的效果。