部署时捆绑器错误

发布于 2024-11-16 20:24:31 字数 780 浏览 3 评论 0原文

我目前正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

灼痛 2024-11-23 20:24:31

我有类似的问题。如果您使用的是 capistrano,您可以设置以下选项:

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

然后将 gem 'rb-fsevent' 行包装在名为 darwin 的组中。像这样的东西应该可以很好地工作:

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

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

bundle --without darwin development test

这意味着它会忽略 Gemfile.lock 中的那些组。你所做的事情会让你的 OS X 机器和你的服务器产生不同的结果锁定文件。这就是它抱怨的原因。

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

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

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

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.

沧笙踏歌 2024-11-23 20:24:31

我遇到了完全相同的问题,卢克的解决方案为我解决了这个问题,但是,只有在我删除 :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.

心奴独伤 2024-11-23 20:24:31

中所述,

正如https://github.com/guard/guard

解决方案很简单

group :development do
  gem 'rb-inotify', :require => false
  gem 'rb-fsevent', :require => false
  gem 'rb-fchange', :require => false
end

As described in

https://github.com/guard/guard

the solution is simply

group :development do
  gem 'rb-inotify', :require => false
  gem 'rb-fsevent', :require => false
  gem 'rb-fchange', :require => false
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文