git push heroku 失败,因为尝试安装开发 gem。 BUNDLE_WITHOUT 命令不起作用

发布于 2024-11-06 07:48:52 字数 5669 浏览 0 评论 0原文

发出 git push heroku 命令后出现错误。这最初看起来像是通过使用 heroku config 命令来捆绑而不使用development:test gems 来解决的。然而,我使用了这个类似的文章中讨论的命令 [ Heroku 试图安装开发 gem,即使我告诉它不要安装],但它仍然不起作用。

下面的推送消息中的“Using --withoutdevelopment:test”行似乎表明 BUNDLE_WITHOUT config 命令有效,所以也许这是一个 gemfile 或其他问题?

谢谢!

$ git push heroku
Counting objects: 64, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (42/42), done.
Writing objects: 100% (48/48), 6.03 KiB, done.
Total 48 (delta 15), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
       Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
       Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test
       Fetching source index for http://rubygems.org/
       Installing rake (0.8.7) 
       Installing ZenTest (4.5.0) 
       Installing abstract (1.0.0) 
       Installing activesupport (3.0.3) 
       Installing builder (2.1.2) 
       Installing i18n (0.5.0) 
       Installing activemodel (3.0.3) 
       Installing erubis (2.6.6) 
       Installing rack (1.2.2) 
       Installing rack-mount (0.6.14) 
       Installing rack-test (0.5.7) 
       Installing tzinfo (0.3.25) 
       Installing actionpack (3.0.3) 
       Installing mime-types (1.16) 
       Installing polyglot (0.3.1) 
       Installing treetop (1.4.9) 
       Installing mail (2.2.15) 
       Installing actionmailer (3.0.3) 
       Installing arel (2.0.9) 
       Installing activerecord (3.0.3) 
       Installing activeresource (3.0.3) 
       Installing autotest (4.4.6) 
       Installing sys-uname (0.8.5) with native extensions 
       Installing autotest-fsevent (0.2.5) with native extensions /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

       /usr/ruby1.8.7/bin/ruby extconf.rb 
       extconf.rb:19: Only Darwin (Mac OS X) systems are supported (RuntimeError)


       Gem files will remain installed in /disk1/tmp/build_258oz7hi5972n/.bundle/gems/ruby/1.8/gems/autotest-fsevent-0.2.5 for inspection.
       Results logged to /disk1/tmp/build_258oz7hi5972n/.bundle/gems/ruby/1.8/gems/autotest-fsevent-0.2.5/ext/fsevent/gem_make.out
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `each'
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions'
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13
        from /usr/ruby1.8.7/bin/bundle:19:in `load'
        from /usr/ruby1.8.7/bin/bundle:19
       FAILED: http://devcenter.heroku.com/articles/bundler
 !     Heroku push rejected, failed to install gems via Bundler

error: hooks/pre-receive exited with error code 1
To [email protected]:blooming-mountain-199.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:blooming-mountain-199.git'

宝石文件...

source 'http://rubygems.org'

gem 'rails', '3.0.3'

gem 'sqlite3', '1.3.3', :require => 'sqlite3'

gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'

gem "nokogiri"
gem "geokit"
gem "rack", "~>1.1"

group :development, :test do
  gem 'rspec-rails', '2.5.0'
  gem 'annotate-models', '1.0.4'
  gem 'faker', '0.3.1'
  gem 'autotest-fsevent' if RUBY_PLATFORM =~ /darwin/
  gem 'rspec', '2.5.0'
  gem 'webrat', '0.7.1'
  gem 'spork', '0.9.0.rc4'
  gem 'factory_girl_rails', '1.0'

  gem 'ZenTest'
  gem 'autotest'
  gem 'autotest-rails'
  gem 'autotest-growl'
end

I get an error after issuing the git push heroku command. This initially looked like something to be solved by using the heroku config command to bundle without the development:test gems. However, I used that command as discussed in this similar writeup [ Heroku's trying to install development gems even after I've told it not to ] and it still doesn't work.

The line "Using --without development:test" in the push message below seems to indicate the BUNDLE_WITHOUT config command worked, so maybe this is a gemfile or other issue?

Thanks!

$ git push heroku
Counting objects: 64, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (42/42), done.
Writing objects: 100% (48/48), 6.03 KiB, done.
Total 48 (delta 15), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
       Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
       Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test
       Fetching source index for http://rubygems.org/
       Installing rake (0.8.7) 
       Installing ZenTest (4.5.0) 
       Installing abstract (1.0.0) 
       Installing activesupport (3.0.3) 
       Installing builder (2.1.2) 
       Installing i18n (0.5.0) 
       Installing activemodel (3.0.3) 
       Installing erubis (2.6.6) 
       Installing rack (1.2.2) 
       Installing rack-mount (0.6.14) 
       Installing rack-test (0.5.7) 
       Installing tzinfo (0.3.25) 
       Installing actionpack (3.0.3) 
       Installing mime-types (1.16) 
       Installing polyglot (0.3.1) 
       Installing treetop (1.4.9) 
       Installing mail (2.2.15) 
       Installing actionmailer (3.0.3) 
       Installing arel (2.0.9) 
       Installing activerecord (3.0.3) 
       Installing activeresource (3.0.3) 
       Installing autotest (4.4.6) 
       Installing sys-uname (0.8.5) with native extensions 
       Installing autotest-fsevent (0.2.5) with native extensions /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

       /usr/ruby1.8.7/bin/ruby extconf.rb 
       extconf.rb:19: Only Darwin (Mac OS X) systems are supported (RuntimeError)


       Gem files will remain installed in /disk1/tmp/build_258oz7hi5972n/.bundle/gems/ruby/1.8/gems/autotest-fsevent-0.2.5 for inspection.
       Results logged to /disk1/tmp/build_258oz7hi5972n/.bundle/gems/ruby/1.8/gems/autotest-fsevent-0.2.5/ext/fsevent/gem_make.out
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `each'
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions'
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13
        from /usr/ruby1.8.7/bin/bundle:19:in `load'
        from /usr/ruby1.8.7/bin/bundle:19
       FAILED: http://devcenter.heroku.com/articles/bundler
 !     Heroku push rejected, failed to install gems via Bundler

error: hooks/pre-receive exited with error code 1
To [email protected]:blooming-mountain-199.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:blooming-mountain-199.git'

Gemfile...

source 'http://rubygems.org'

gem 'rails', '3.0.3'

gem 'sqlite3', '1.3.3', :require => 'sqlite3'

gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'

gem "nokogiri"
gem "geokit"
gem "rack", "~>1.1"

group :development, :test do
  gem 'rspec-rails', '2.5.0'
  gem 'annotate-models', '1.0.4'
  gem 'faker', '0.3.1'
  gem 'autotest-fsevent' if RUBY_PLATFORM =~ /darwin/
  gem 'rspec', '2.5.0'
  gem 'webrat', '0.7.1'
  gem 'spork', '0.9.0.rc4'
  gem 'factory_girl_rails', '1.0'

  gem 'ZenTest'
  gem 'autotest'
  gem 'autotest-rails'
  gem 'autotest-growl'
end

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

幸福不弃 2024-11-13 07:48:52

嗯,问题显然是当你推送到 Heroku 时加载 autotest-fsevent,它不是基于 Darwin 的。尽管您在 gem 'autotest-fsevent' 语句后面确实有一个条件,但当您部署到 Heroku 时,gem 仍会尝试加载。造成这种情况的可能原因有两个。

首先,另一个宝石需要它。如果不出意外的话,autotest-growl 也应该是仅限 Darwin 的。我不确定这些是否相关,但我仍然会仔细检查。

下一个问题是确保 Gemfile.lock 不会被推送。如果您上次在 Darwin 上运行 bundle install,gem 可能会以这种方式锁定到依赖项中。在提交并推送到 Heroku 之前,git rm Gemfile.lock

最后,最喜欢的解决方案是不使用自动测试。我不确定这是否适合您,但当我使用 RSpec 和 Cucumber 时,我发现它很烦人。我意识到最后一个建议是没有答案的,但我不喜欢包含依赖于平台的 gem,即使在测试中, 只是因为当你进行登台时,像这样的小烦恼有被裁剪的倾向向上。

我不确定为什么 Rails 教程仍然使用 ZenTest 和自动测试,我不知道有谁这样做...这可能会改变,一位朋友参加了 RailsConf 的 Rails 教程会议,并说 Michael 实际上在会议期间注意到了勘误表教程,所以也许未来的版本会有所不同。

最后一点,出于好奇,如果您使用的是 OS X,您是如何安装 Ruby 的?它位于一个非常奇怪的地方。

Well, the problem is clearly with the autotest-fsevent getting loaded when you push to Heroku, which is not Darwin-based. Although you do have a conditional following the gem 'autotest-fsevent' statement, the gem is still trying to load when you deploy to Heroku. There are two likely causes for this.

The first, is that another gem is requiring it. If nothing else, autotest-growl should also be Darwin-only. I'm not sure these are related, but I'd still double-check.

The next issue is to make sure that Gemfile.lock isn't getting pushed. If you last ran bundle install on Darwin, it's possible that the gem got locked into the dependencies that way. git rm Gemfile.lock before you commit and push to Heroku.

Finally, my favored solution is not to use autotest. I'm not sure if that's an option for you, but I found it to be annoying when I did use it I use RSpec and Cucumber. I realize this last suggestion is a non-answer, but I don't like including platform-dependent gems even in testing, just because when you go to staging, little annoyances like this have a tendency of cropping up.

I'm not sure why Rails Tutorial is still using ZenTest and autotest, I don't know anyone who does... that might be changing, a friend went to the Rails Tutorial session at RailsConf and said Michael was actually noting errata during the tutorial, so maybe it'll be different in a future version.

As a final note, out of curiosity, if you are on OS X, how did you install Ruby? It's in a very odd place.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文