【问题标题】:Unable to deploy Ruby App to Heroku无法将 Ruby 应用程序部署到 Heroku
【发布时间】:2018-06-18 19:57:06
【问题描述】:

我对这些东西很陌生。我刚刚在此之前部署了一个不同的应用程序,所以我不知道这是否是原因。无论如何,我执行了标准 Heroku 步骤来部署,但我收到以下错误:

    remote:        /tmp/build_70ac51f84d237880d076a5b324fee21c/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
remote:        Tasks: TOP => environment
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to glacial-island-90844.
remote: 
To https://git.heroku.com/glacial-island-90844.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/glacial-island-90844.git'

宝石文件:

    source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  gem 'sqlite3'
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

Heroku 日志:

    2018-06-16T11:26:38.801026+00:00 app[api]: Release v1 created by user sbeezynen@gmail.com
2018-06-16T11:26:38.801026+00:00 app[api]: Initial release by user sbeezynen@gmail.com
2018-06-16T11:26:38.953219+00:00 app[api]: Enable Logplex by user sbeezynen@gmail.com
2018-06-16T11:26:38.953219+00:00 app[api]: Release v2 created by user sbeezynen@gmail.com
2018-06-16T11:28:14.000000+00:00 app[api]: Build started by user sbeezynen@gmail.com
2018-06-16T11:28:49.000000+00:00 app[api]: Build failed -- check your build logs
2018-06-16T11:33:13.000000+00:00 app[api]: Build started by user sbeezynen@gmail.com
2018-06-16T11:33:48.000000+00:00 app[api]: Build failed -- check your build logs

知道是什么原因造成的吗?我可以从 Heroku Dashboard 看到 heroku 应用程序。我已经做了 'git add -A' 'git commit' 和 'git push' 了。

【问题讨论】:

  • 你能在本地预编译资产吗?
  • 是的。如果我运行我的 Rails 服务器。没关系。
  • @j_nguyen run rake assets:precompile,你通常不需要为开发服务器运行它,但是它在你部署时运行,所以你要确保它在本地工作
  • 也可以在本地主机RAILS_ENV=production rake assets:precompile尝试生产版本

标签: ruby-on-rails ruby heroku


【解决方案1】:

可能有一些 CSS 或 JS 可以通过 Heroku(Ruby on Rails)的预编译器进行编译。因此,首先尝试在启用生产模式的情况下在本地编译文件,看看它是否正在编译,如果没有,然后查找它抛出的错误。如果不是,那一定是heroku上的一些配置问题。

【讨论】:

    【解决方案2】:

    您可以在给定的情况下验证您的 css 文件或代码 link

    如果代码中有任何错误,则会在行号上显示或突出显示。

    【讨论】:

      猜你喜欢
      • 2015-10-25
      • 2012-10-30
      • 2017-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多