1

我正在尝试在 heroku 上部署侨民,但在部署时遇到此错误,我在 ubuntu 14.04 上使用带有 ruby​​ 2.0.0 的 rails 4.1.8 我尝试过bundle update但它不起作用..任何解决方案..??

> ahmed@ahmed-desktop:~/diaspora$ git push -u heroku heroku:master
> Counting objects: 132081, done.
> Delta compression using up to 2 threads.
> Compressing objects: 100% (29619/29619), done.
> Writing objects: 100% (132081/132081), 91.87 MiB | 163.00 KiB/s, done.
> Total 132081 (delta 101146), reused 132070 (delta 101138)
> remote: Compressing source files... done.
> remote: Building source:
> remote:
> remote: -----> Deleting 6 files matching .slugignore patterns.
> remote: -----> Ruby app detected
> remote: -----> Compiling Ruby/Rails
> remote: -----> Using Ruby version: ruby-2.0.0
> remote: -----> Installing dependencies using 1.7.12
> remote:        Running: bundle install --without development:test --path
> vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
> remote:        You are trying to install in deployment mode after changing
> remote:        your Gemfile. Run `bundle install` elsewhere and add the
> remote:        updated Gemfile.lock to version control.
> remote:        You have deleted from the Gemfile:
> remote:        * mysql2 (= 0.3.16)
> remote:        Bundler Output: You are trying to install in deployment
> mode after changing
> remote:        your Gemfile. Run `bundle install` elsewhere and add the
> remote:        updated Gemfile.lock to version control.
> remote:
> remote:        You have deleted from the Gemfile:
> remote:        * mysql2 (= 0.3.16)
> remote:  !
> remote:  !     Failed to install gems via Bundler.
> remote:  !
> remote:
> remote:  !     Push rejected, failed to compile Ruby app
> remote:
> remote: Verifying deploy...
> remote:
> remote: !    Push rejected to reddodo.
> remote:
> To https://git.heroku.com/reddodo.git
>  ! [remote rejected] heroku -> master (pre-receive hook declined)
> error: failed to push some refs to 'https://git.heroku.com/reddodo.git'
4

2 回答 2

0

您跳过了部分安装说明,即:

我们需要将 Gemfile.lock 切换到 PostgreSQL。编辑Gemfile并更改ENV['DB'] ||= 'mysql'ENV['DB'] ||= 'postgres'. 然后运行:

bundle --without development test heroku production assets
git add Gemfile Gemfile.lock
git commit -m "switch Gemfile.lock to pg exclusivly"
于 2015-03-04T11:07:41.847 回答
0

我相信问题是heroku不支持开箱即用的mysql。您将需要切换到 Postgres 或使用插件,例如ClearDB

更新:转念一想可能是这个

您收到的有关 Gemfile.lock 的错误消息可能是因为您的 Gemfile 和 Gemfile.lock 彼此不一致。自从您上次运行 bundle install(或更新)以来,听起来您已经更改了 Gemfile 中的某些内容。当您捆绑安装时,它会使用您对 Gemfile 所做的任何更改来更新您的 Gemfile.lock。

确保在本地运行 bundle install,然后签入以控制新更新的 Gemfile.lock 的源代码。然后尝试部署。

编辑:正如评论中所承认的,Gemfile 中的条件导致一个平台上有效的 Gemfile.lock,在另一个平台上无效。在 Gemfile 中为这些平台相关的 gem 提供一个 :platform 标志应该可以解决不对称问题。

〜埃德摩根

于 2015-03-04T10:39:53.377 回答