部署中的捆绑器错误 [英] Bundler error on deployment

查看:80
本文介绍了部署中的捆绑器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在OSX开发系统上使用Guard(即guard-coffeescript gem)来编译我的JavaScript(将来我可能会添加更多的Guard任务).我在我的Gemspec中添加了rb-fsevent gem,现在我看到在许多Gemspec中都添加了一个if语句,如下所示:

I'm currently using guard i.e. guard-coffeescript gem to compile my javascript (and in the future I'll probably add some more guard tasks) on my OSX dev system. I added the rb-fsevent gem to my Gemspec, now I saw that in a lot of Gemspecs it is added with an if statement like this:

gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i

尝试部署到我的在Linux下运行的登台/生产环境中,在服务器上执行的脚本使用bundle install --deployment结果,但出现以下异常:

Trying to deploy to my staging/production environment, which is running under Linux, the script executed on the server uses the bundle install --deployment results in following exception:

# bundle install --deployment
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control

You have deleted from the Gemfile:
* rb-fsevent

是否有解决此问题的方法,还是只需要删除if以便我可以部署到我的系统,然后安装在非OSX平台上无用的gem?

Is there a way around this problem or do I just have to remove the if so that I can deploy to my system and in turn installing a gem that is useless on a non OSX platform?

-

edit:在部署到我的暂存环境之前,我先运行bundle install,在第一次失败后再运行bundle check.删除if语句后,它开始运行..

edit: I run bundle install before deploying to my staging environment and run bundle check after the first time it failed. I got it running after removing the if statement..

推荐答案

我遇到了类似的问题.如果您使用的是capistrano,则可以设置以下选项:

I had a similar problem. If you're using capistrano you can set the following option:

set :bundle_without, [:darwin, :development, :test]

然后将您的gem'rb-fsevent'行包装到名为darwin的组中.这样的事情应该可以很好地工作:

Then wrap your gem 'rb-fsevent' line in a group called darwin. Something like this should work nicely:

group :test, :darwin do
  gem 'rb-fsevent'
end

这使捆绑程序在服务器上执行此操作:

This makes bundler do this on the server:

bundle --without darwin development test

这意味着它将忽略Gemfile.lock中的那些组.您正在执行的操作将使您的OS X计算机和服务器使用不同的结果锁定文件.这就是为什么它抱怨的原因.

Which means that it ignores those groups in the Gemfile.lock. What you were doing would make you OS X machine and your server come up with different resulting lock files. Which is why it was complaining.

这篇关于部署中的捆绑器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆