我对整个部署工作还是个新手。当我第一次创建我的应用程序时,我已经部署过它一次,当时一切似乎都很正常。我现在已经对我的应用程序做了一些更改,我想部署它们并确保它们在生产环境中工作。我添加并提交了最后一个更改,并将更改合并到我的主分支中。然后我运行了git push heroku master。我在输出中收到以下错误:
Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control好的,所以我需要更新我的文件。首先,我检查了.gitignore文件的内容,它们是:
.bundle
db/*.sqlite3*
log/*.log
*.log
/tmp/
doc/
*.swp
*~
.project
.DS_Store
.psdGemfile.lock似乎不在其中,但我还是尝试了以下方法:
git add .
git commit -m "updated Gemfile.lock"然后我再次向Heroku推送,得到了同样的错误。接下来,我尝试了:
git add Gemfile Gemfile.lock
git commit -m "updated Gemfile.lock (again)"经过推送,我得到了同样的结果。在搜索了一段时间后,我找到了this帖子,这促使我尝试以下操作:
gem update bundler
bundle update
git add Gemfile Gemfile.lock
git commit -m "updated Gemfile.lock (again (again))"仍然没有运气,而且我在这一点上几乎没有想法。如果有任何建议,我将不胜感激。
发布于 2011-06-28 07:08:47
好吧,事实证明答案很简单。根据Heroku Support Guy的说法,你不能在Gemfile中使用if语句。我的Gemfile中令人不快的一行是:
gem 'rb-fsevent', :require => true if (RUBY_PLATFORM =~ /darwin/i)发布于 2011-10-01 04:05:56
我们在Linux和Mac上都在使用Guard,在部署Heroku时遇到了同样的问题。我们的解决方法是将Gem作为插件安装,而不是在Gemfile中的条件中安装。在我们的示例中,对Gemfile的更改如下:
# guard
gem "growl", "~> 1.0.3"
gem "guard-coffeescript", "0.4.1"
gem "guard-sass", "0.3.3"
gem "rb-fsevent", "0.4.3.1"
gem "libnotify"
#gem "rb-inotify", "~> 0.8.8", :require => false if RUBY_PLATFORM =~ /darwin/i然后我们运行:rails plugin install git://github.com/nex3/rb-inotify.git,就可以运行了。
发布于 2011-06-09 14:35:42
你有没有Gemfile.lock文件?它应该和你的Gemfile在同一个目录下。
如果没有,运行"bundle install“。这应该会创建它。
如果仍然不能解决你的问题,那么我会尝试重新开始:克隆你的git存储库到一个新的空目录中,运行bundle install,运行你的测试,启动你的开发服务器并尝试-简而言之,确保一切正常,然后再次尝试部署到heroku。
https://stackoverflow.com/questions/6288910
复制相似问题