0

我正在尝试使用 GIT 在 Heroku 上部署 Rails 应用程序。我应用了我在 stackoverflow 中找到的所有我认为相关的解决方案。

这是我所做的:

STEP 1:以下是我得到的命令和结果:

Hesham@HESHAM-PC /c/rails_projects/first_app (Hesh1)

$ git push heroku1 master

Enter passphrase for key '/c/Users/Hesham/.ssh/id_rsa':
Counting objects: 77, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (55/55), done.
Writing objects: 100% (77/77), 27.15 KiB, done.
Total 77 (delta 8), reused 71 (delta 6)

-----> Heroku receiving push  
-----> Ruby/Rails app detected  
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done  
-----> Configure Rails 3 to disable x-sendfile
       Installing rails3_disable_x_sendfile... done  
-----> Configure Rails to log to stdout
       Installing rails_log_stdout... done  
-----> Gemfile detected, running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...  
       Using --without development:test  
       Windows Gemfile.lock detected, ignoring it.  
       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:
       * source: rubygems repository https://rubygems.org/
       * rails (= 3.2.3)
       * sqlite3
       * sass-rails (~> 3.2.3)
       * coffee-rails (~> 3.2.1)
       * uglifier (>= 1.0.3)
       * jquery-rails
       FAILED: http://devcenter.heroku.com/articles/bundler
 !     Heroku push rejected, failed to install gems via Bundler

To git@heroku.com:fierce-mountain-7869.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:fierce-mountain-7869.git'

Hesham@HESHAM-PC /c/rails_projects/first_app (Hesh1)

STEP2:当我得到上述结果时,我运行了以下内容:

Hesham@HESHAM-PC /c/rails_projects/first_app (Hesh1)

$ bundle update

You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

If this is a development machine, remove the Gemfile freeze
by running `bundle install --no-deployment`.

You have added to the Gemfile:
* source: rubygems repository https://rubygems.org/
* rails (= 3.2.3)
* sqlite3
* sass-rails (~> 3.2.3)
* coffee-rails (~> 3.2.1)
* uglifier (>= 1.0.3)
* jquery-rails

Hesham@HESHAM-PC /c/rails_projects/first_app (Hesh1)

STEP3:我按照建议运行了这个:

Hesham@HESHAM-PC /c/rails_projects/first_app (Hesh1)

$ bundle install --no-deployment

Using rake (0.9.2.2)  
Using i18n (0.6.0)  
Using multi_json (1.2.0)  
Using activesupport (3.2.3)  
Using builder (3.0.0)  
Using activemodel (3.2.3)  
Using erubis (2.7.0)  
Using journey (1.0.3)  
Using rack (1.4.1)  
Using rack-cache (1.2)  
Using rack-test (0.6.1)  
Using hike (1.2.1)  
Using tilt (1.3.3)  
Using sprockets (2.1.2)  
Using actionpack (3.2.3)  
Using mime-types (1.18)  
Using polyglot (0.3.3)  
Using treetop (1.4.10)  
Using mail (2.4.4)  
Using actionmailer (3.2.3)  
Using arel (3.0.2)  
Using tzinfo (0.3.33)  
Using activerecord (3.2.3)  
Using activeresource (3.2.3)  
Using coffee-script-source (1.2.0)  
Using execjs (1.3.0)  
Using coffee-script (2.2.0)  
Using rack-ssl (1.3.2)  
Using json (1.6.6)  
Using rdoc (3.12)  
Using thor (0.14.6)  
Using railties (3.2.3)  
Using coffee-rails (3.2.2)  
Using jquery-rails (2.0.2)  
Using bundler (1.1.3)  
Using rails (3.2.3)  
Using sass (3.1.15)  
Using sass-rails (3.2.5)  
Using sqlite3 (1.3.5)  
Using uglifier (1.2.4)  
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Hesham@HESHAM-PC /c/rails_projects/first_app (Hesh1)

STEP4:我仍然得到相同的结果:

Hesham@HESHAM-PC /c/rails_projects/first_app (Hesh1)

$ git push heroku1 master

Enter passphrase for key '/c/Users/Hesham/.ssh/id_rsa':
Counting objects: 77, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (55/55), done.
Writing objects: 100% (77/77), 27.15 KiB, done.
Total 77 (delta 8), reused 71 (delta 6)

-----> Heroku receiving push  
-----> Ruby/Rails app detected  
-----> Detected Rails is not set to serve static_assets  
       Installing rails3_serve_static_assets... done  
-----> Configure Rails 3 to disable x-sendfile  
       Installing rails3_disable_x_sendfile... done  
-----> Configure Rails to log to stdout  
       Installing rails_log_stdout... done  
-----> Gemfile detected, running Bundler version 1.0.7  
       Unresolved dependencies detected; Installing...  
       Using --without development:test  
       Windows Gemfile.lock detected, ignoring it.  
       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:
       * source: rubygems repository https://rubygems.org/
       * rails (= 3.2.3)
       * sqlite3
       * sass-rails (~> 3.2.3)
       * coffee-rails (~> 3.2.1)
       * uglifier (>= 1.0.3)
       * jquery-rails
       FAILED: http://devcenter.heroku.com/articles/bundler
 !     Heroku push rejected, failed to install gems via Bundler

To git@heroku.com:fierce-mountain-7869.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:fierce-mountain-7869.git'

Hesham@HESHAM-PC /c/rails_projects/first_app (Hesh1)

git add Gemfile.lock我还使用and添加了 Gemfile 和 Gemfile.lock并git add Gemfile确保 .gitignore 中没有提到它们

为了成功部署到 Heroku,我还能尝试什么?

4

1 回答 1

1

这是由于 Heroku 不允许 Gemfile 中的条件,即使在开发组中也是如此。

http://www.johnplummer.com/rails/heroku-error-conditional-rbfsevent-gem.html

于 2014-05-06T21:22:28.877 回答