【问题标题】:error while deploying diaspora on heroku Failed to install gems via Bundler在 Heroku 上部署侨民时出错 无法通过 Bundler 安装 gem
【发布时间】:2015-05-05 06:46:19
【问题描述】:

我正在尝试在 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'

【问题讨论】:

    标签: ruby-on-rails heroku gem bundler diaspora


    【解决方案1】:

    你跳过了installation instructions的一部分,即:

    我们需要将 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"
    

    【讨论】:

      【解决方案2】:

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

      更新: 转念一想可能是this

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

      确保您在本地运行捆绑安装,并签入到源 之后控制你新更新的 Gemfile.lock 。然后尝试 部署。

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

      ~埃德·摩根

      【讨论】:

      • 你能解释一下我要做什么
      • 尝试在本地运行“bundle install”,然后将这些更改(如果有)提交给 heroku
      猜你喜欢
      • 1970-01-01
      • 2015-09-23
      • 1970-01-01
      • 2019-01-07
      • 2021-08-27
      • 2021-08-26
      • 1970-01-01
      • 2011-04-14
      • 1970-01-01
      相关资源
      最近更新 更多