在heroku

时间:2016-04-25 03:58:57

标签: ruby-on-rails ruby heroku deployment

我在heroku上从github部署我的应用程序时遇到此错误...

构建日志 - >

-----> Ruby app detected

-----> Compiling Ruby/Rails

-----> Using Ruby version: ruby-2.2.0

-----> Installing dependencies using bundler 1.11.2

       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment

       Fetching gem metadata from https://rubygems.org/...........

       Fetching version metadata from https://rubygems.org/...

       Fetching dependency metadata from https://rubygems.org/..

       Installing json 1.8.3 with native extensions

       Installing i18n 0.7.0

       Installing rake 10.5.0

       Installing minitest 5.8.3

       Installing thread_safe 0.3.5

       Installing builder 3.2.2

       Installing erubis 2.7.0

       Installing mini_portile2 2.0.0

       Installing rack 1.6.4

       Installing mime-types 2.99

       Installing sass 3.4.21

       Installing thor 0.19.1

       Installing coffee-script-source 1.10.0

       Installing formtastic_i18n 0.6.0

       Using bundler 1.11.2

       Installing arel 6.0.3

       Installing execjs 2.6.0

       Installing concurrent-ruby 1.0.0

       Installing tilt 1.4.1

       Installing bcrypt 3.1.7 with native extensions

       Installing cancan 1.6.10

       Installing orm_adapter 0.5.0

       Installing multi_json 1.11.2

       Installing request_store 1.3.0

       Installing puma 2.16.0 with native extensions

       Installing rails_serve_static_assets 0.0.4

       Installing rails_stdout_logging 0.0.4

       Installing tzinfo 1.2.2

       Installing rack-test 0.6.3

       Installing nokogiri 1.6.7.1 with native extensions

       Installing warden 1.2.6

       Installing rdoc 4.2.1

       Installing mail 2.6.3

       Installing bourbon 4.2.7

       Installing coffee-script 2.4.1

       Installing uglifier 2.5.3

       Installing autoprefixer-rails 6.3.1

       Installing sprockets 3.5.2

       Installing rails_12factor 0.0.2

       Installing sdoc 0.4.0

       Installing activesupport 4.2.2

       Installing bootstrap-sass 3.3.6

       Installing rails-deprecated_sanitizer 1.0.3

       Installing globalid 0.3.6

       Installing arbre 1.0.3

       Installing activemodel 4.2.2

       Installing jbuilder 2.2.3

       Installing pundit 1.1.0

       Installing activejob 4.2.2

       Installing activerecord 4.2.2

       Installing polyamorous 1.3.0

       Installing rails-dom-testing 1.0.7

       Installing loofah 2.0.3

       Installing rails-html-sanitizer 1.0.2

       Installing actionview 4.2.2

       Installing actionpack 4.2.2

       Installing actionmailer 4.2.2

       Installing railties 4.2.2

       Installing formtastic 3.1.4

       Installing has_scope 0.6.0

       Installing sprockets-rails 3.0.0

       Installing kaminari 0.16.3

       Installing ransack 1.7.0

       Installing draper 2.1.0

       Installing coffee-rails 4.1.0

       Installing responders 2.1.1

       Installing jquery-ui-rails 5.0.5

       Installing jquery-rails 4.0.3

       Installing rails 4.2.2

       Installing turbolinks 2.3.0

       Installing sass-rails 5.0.2

       Installing inherited_resources 1.6.0

       Installing devise 3.5.6

       Installing activeadmin 1.0.0.pre2

       Bundle complete! 24 Gemfile dependencies, 74 gems now installed.

       Gems in the groups development and test were not installed.

       Bundled gems are installed into ./vendor/bundle.

       Post-install message from rdoc:

       Depending on your version of ruby, you may need to install ruby rdoc/ri data:

       <= 1.8.6 : unsupported

       = 1.8.7 : gem install rdoc-data; rdoc-data --install

       = 1.9.1 : gem install rdoc-data; rdoc-data --install

       >= 1.9.2 : nothing to do! Yay!

       Bundle completed (23.34s)

       Cleaning up the bundler cache.

sh: 2: Syntax error: Unterminated quoted string

sh: 2: Syntax error: Unterminated quoted string

 !

 !     Could not detect rake tasks

 !     ensure you can run `$ bundle exec rake -P` against your app

 !     and using the production group of your Gemfile.

 !     rake aborted!

 !     Bundler::GemRequireError: There was an error while trying to load the gem 'activeadmin'.

 !     /tmp/build_e5688395917c72f2956d14c05dd2fdf5/nischaynamdev-hostel_mess_pay-a993b86d6645abbdfb41cb6de99c6900648d588f/vendor/bundle/ruby/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require'

 !     /tmp/build_e5688395917c72f2956d14c05dd2fdf5/nischaynamdev-hostel_mess_pay-a993b86d6645abbdfb41cb6de99c6900648d588f/vendor/bundle/ruby/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'

 !     /tmp/build_e5688395917c72f2956d14c05dd2fdf5/nischaynamdev-hostel_mess_pay-a993b86d6645abbdfb41cb6de99c6900648d588f/vendor/bundle/ruby/2.2.0/gems/bundler-1.11

我的production.rb文件:

    Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.
  # Code is not reloaded between requests.
  config.cache_classes = true
  config.force_ssl = true
  config.serve_static_assets = true
  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Enable Rack::Cache to put a simple HTTP cache in front of your application
  # Add `rack-cache` to your Gemfile before enabling this.
  # For large-scale production use, consider using a caching reverse proxy like
  # NGINX, varnish or squid.
  # config.action_dispatch.rack_cache = true

  # Disable serving static files from the `/public` folder by default since
  # Apache or NGINX already handles this.
  config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?

  # Compress JavaScripts and CSS.
  config.assets.js_compressor = :uglifier
  # config.assets.css_compressor = :sass

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile =true

  # Asset digests allow you to set far-future HTTP expiration dates on all assets,
  # yet still be able to expire them through the digest params.
  config.assets.digest = true

  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb

  # Specifies the header that your server uses for sending files.
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # Use the lowest log level to ensure availability of diagnostic information
  # when problems arise.
  config.log_level = :debug

  # Prepend all log lines with the following tags.
  # config.log_tags = [ :subdomain, :uuid ]

  # Use a different logger for distributed setups.
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

  # Use a different cache store in production.
  # config.cache_store = :mem_cache_store

  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
  # config.action_controller.asset_host = 'http://assets.example.com'

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  # config.action_mailer.raise_delivery_errors = false

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation cannot be found).
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners.
  config.active_support.deprecation = :notify

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # Do not dump schema after migrations.
  config.active_record.dump_schema_after_migration = false
  config.assets.precompile +=
      %w( #{Rails.root}/vendor/assets/stylesheets/active_admin.css.scss)
  config.assets.precompile +=
      %w( #{Rails.root}/vendor/assets/javascripts/active_admin.js.coffee)

  RAILS_ENV=production bundle exec rake assets:precompile

  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = 'messpay.herokuapp.com'
  config.action_mailer.default_url_options = { host: host }
  ActionMailer::Base.smtp_settings = {
      :address        => 'smtp.sendgrid.net',
      :port           => '587',
      :authentication => :plain,
      :user_name      => ENV['SENDGRID_USERNAME'],
      :password       => ENV['SENDGRID_PASSWORD'],
      :domain         => 'heroku.com',
      :enable_starttls_auto => true
end

Rake文件

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

Rails.application.load_tasks

的Gemfile:

source 'https://rubygems.org'
gem 'jquery-ui-rails'

gem 'activeadmin', '~> 1.0.0.pre2'
gem 'devise'
gem 'cancan'
gem 'draper'
gem 'pundit'
gem 'rails',        '4.2.2'
gem 'bcrypt',               '3.1.7'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
gem 'sass-rails',   '5.0.2'
gem 'uglifier',     '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks',   '2.3.0'
gem 'jbuilder',     '2.2.3'
gem 'sdoc',         '0.4.0', group: :doc

group :development, :test do
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'

  gem 'spring',      '1.1.3'
end

group :test do
  gem 'minitest-reporters', '~> 1.1', '>= 1.1.7'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard-minitest',     '2.3.1'
end

group :production do
  gem 'rails_12factor', '0.0.2'
  gem 'puma', '~> 2.16'
end

我已经尝试了大多数预编译的命令选项,你可以检查我的production.rb但是构建日志在活动的admin gem中显示出问题!

帮助我plz thxx

1 个答案:

答案 0 :(得分:0)

看看你的宝石文件。尝试为生产环境加载gem ActiveAdmin似乎有一个问题,我会从那里开始,可能会将其上传到查看。

**查看Gemfile后......我认为可能没问题。

因此,我认为将config.assets.compile =true更改为config.assets.compile = true因此,基本上会在导致问题的情况下添加空格。然后我会像错误本身一样运行bundle exec rake -P。然后尝试rake assets:precompile,看看是否能解决问题。您可能还需要运行heroku run rake db:migrate。我之前和Heroku一起遇到过这样的问题。