我正在尝试在heroku上部署侨民,但在ubuntu 14.04上使用rails 4.1.8和ruby 2.0.0进行部署时遇到此错误我曾尝试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'
答案 0 :(得分:0)
我认为问题是heroku不支持开箱即用的mysql。您需要切换到Postgres或使用插件,例如ClearDB。
更新: 第二个想法可能是this
您收到的有关Gemfile.lock的错误消息可能是因为 你的Gemfile和Gemfile.lock不同意。听起来 就像你上次运行以来你在Gemfile中改变了一些东西 捆绑安装(或更新)。捆绑安装时,它会更新您的 Gemfile.lock包含您对Gemfile所做的任何更改。
确保在本地运行bundle install,并签入源代码 之后控制新更新的Gemfile.lock。然后试试 展开。
编辑:正如评论中所认识到的那样,Gemfile中有条件 在一个平台上导致有效的Gemfile.lock,在另一个平台上无效。 为这些平台相关的宝石提供:平台标志 Gemfile应该解决不对称问题。
~Edd Morgan
答案 1 :(得分:0)
您跳过部分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"