Bundler 忽略 Rails 应用程序中的组
这个问题在 0.9.8 中被修复,但似乎在 1.x 分支中再次出现。
在我的 Gemfile 中,我有一个使用 rspec gem 的测试和开发环境组。 我的生产服务器上未安装 rspec。 我在我的应用程序中使用了命令bundle install --without testdevelopment
Rails 应用程序
在生产模式下启动我的 Rails 应用程序会出现异常:
在列出的任何 gem 源中都找不到 gem 'rspec (>= 0)' 你的 Gemfile。
如果我注释掉测试组,开发组也会发生同样的错误。
如果我以开发模式启动,则存在同样的问题,然后它尝试加载测试组中的 gem。
看来bundler完全忽略了环境组并尝试加载Gemfile中的所有gem:
group :test do
gem "rspec"
end
group :development do
gem "rspec-rails"
end
versions:
bundle 1.0.15
rails 3.0.7
ruby 1.9.2-p180
This problem was fixed in 0.9.8, but seems to have recurred in the 1.x branch.
In my Gemfile I have a group for the test and development environments that use the rspec gems.
On my production server rspec is not installed.
I used the command bundle install --without test development
in my
rails app
Starting my rails app in production mode gives the exception:
Could not find gem 'rspec (>= 0)' in any of the gem sources listed in
your Gemfile.
If I comment out the test group the same error happens with the development group.
The same problem exists if I start in development mode, then it tries to load the gems in the test group.
It seems that bundler completely ignores the environment groups and tries to load all gems in Gemfile:
group :test do
gem "rspec"
end
group :development do
gem "rspec-rails"
end
versions:
bundle 1.0.15
rails 3.0.7
ruby 1.9.2-p180
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到了这个问题,问题是 .bundle/config 文件有类似的内容
“——未经开发测试”
即使我从未使用此参数运行过bundle命令(也许我从Webbynode服务器克隆了存储库,并且他们的系统自动添加了这个以进行生产......)
无论如何,修复是
I was having this problem too, the problem was that .bundle/config file had something like
"--without development test"
even tho I had never ran the bundle command with this parameters(maybe I cloned the repository from the Webbynode server and their system added this automatically for production...)
anyway, the fix was