部署时捆绑器错误
我目前正在使用 Guard ie Guard-Coffeescript gem 在我的 OSX 开发系统上编译我的 javascript(将来我可能会添加更多的防护任务)。我将 rb-fsevent
gem 添加到我的 Gemspec 中,现在我看到在很多 Gemspec 中都添加了这样的 if 语句:
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
尝试部署到正在运行的我的临时/生产环境在 Linux 下,在服务器上执行的脚本使用 bundle install --deployment
导致以下异常:
# 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 以便我可以部署到我的系统,然后安装一个gem 在非 OSX 平台上没用?
--
编辑:我在部署到临时环境之前运行bundle install
,并在第一次失败后运行bundle check
。删除 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
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
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: 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..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我有类似的问题。如果您使用的是 capistrano,您可以设置以下选项:
然后将 gem 'rb-fsevent' 行包装在名为 darwin 的组中。像这样的东西应该可以很好地工作:
这使得捆绑器在服务器上执行此操作:
这意味着它会忽略 Gemfile.lock 中的那些组。你所做的事情会让你的 OS X 机器和你的服务器产生不同的结果锁定文件。这就是它抱怨的原因。
I had a similar problem. If you're using capistrano you can set the following option:
Then wrap your gem 'rb-fsevent' line in a group called darwin. Something like this should work nicely:
This makes bundler do this on the server:
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.
我遇到了完全相同的问题,卢克的解决方案为我解决了这个问题,但是,只有在我删除
:require =>; 后才解决。如果 RUBY_PLATFORM =~ /darwin/i
常用字符串则为 false。I had the exact same issue and Luke's solution fixed it for me, however, only after I removed the
:require => false if RUBY_PLATFORM =~ /darwin/i
string that is commonly used.中所述,
正如https://github.com/guard/guard
解决方案很简单
As described in
https://github.com/guard/guard
the solution is simply