在Heroku上部署Rails应用程序

4

我正在学习RoR,并尝试将我的测试应用程序部署到Heroku,但遇到了以下错误:

Unresolved dependencies detected; Installing...
   Using --without developmen
   You have modified your Gemfile in development but did not check
   the resulting snapshot (Gemfile.lock) into version control

   You have added to the Gemfile:
   * therubyracer (~> 0.9.3.beta1)
   * pg
   FAILED: http://devcenter.heroku.com/articles/bundler

!Heroku 推送被拒绝,通过 Bundler 安装 gem 失败。

请帮忙!

2个回答

7
你是否已经提交了你的Gemfile.lock文件?
bundle install 
git add Gemfile.lock
git commit -am "Add lock file"
git push heroku master

1
在此之前,您是否运行了 bundle install 命令? - Chowlett

2
这个错误可能是因为你没有完全执行 bundle install。首先执行:
bundle install 

在gem文件中添加gem 'pg',并安装Postgres gems和Postgres到您的本地机器上。如果您不想在本地机器上安装Postgres,则将gem 'pg'添加到生产环境中,并在没有测试环境的情况下运行bundle install。虽然Heroku不鼓励这种方式运行您的应用程序,但始终最好在本地和生产环境中使用相同的数据库。安装Postgres可能会有些繁琐,但它是值得的。

Your ruby should be 1.9.2. 

在您的计算机上安装所有依赖项和Postgres之后,执行 bundle install 并将您的 gem 文件添加到 Heroku。
git add Gemfile
git add Gemfile.lock
git commit 
git push heroku master

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接