2014-01-02 3 views
0

пару дней назад я заметил, что календарь jquery не работает на моем сайте развертывания (heroku). при выкапывании проблемы я заметил, что источник сайта на моем dev-сервере содержит около 100 тегов скриптов, связанных с загрузкой (я использую twitter bootstrap css), но на prod-сервере. У меня есть 4 скриптовых тега. при поиске я обнаружил, что должен запускать rake assets:precompile на моей консоли rails для конвейера. но во время работы он занимает очень долгое время, в последний раз это заняло 6 часов, и мне пришлось отменить его.rake assets: precompile stuck

со ссылкой на многих сайтах и ​​пост, я обнаружил, что я должен изменить config.serve_static_assets к true и config.assets.compile к true. но проблема все еще существует. Я также попытался удалить jquery-rails/jquery-ui-rails от gem, но проблема все еще там. вот мой config/environmnets/production.rb

ProductRecall::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 

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

    # Disable Rails's static asset server (Apache or nginx will already do this) 
    config.serve_static_assets = true 

    # Compress JavaScripts and CSS 
    config.assets.compress = true 

    # Don't fallback to assets pipeline if a precompiled asset is missed 
    config.assets.compile = true 

    # Generate digests for assets URLs 
    config.assets.digest = true 



    # 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 

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

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

    # Log the query plan for queries taking more than this (works 
    # with SQLite, MySQL, and PostgreSQL) 
    # config.active_record.auto_explain_threshold_in_seconds = 0.5 

    config.action_controller.perform_caching = false 
end 

config/application.rb мой выглядит так

require File.expand_path('../boot', __FILE__) 

# Pick the frameworks you want: 
require "active_record/railtie" 
require "action_controller/railtie" 
require "action_mailer/railtie" 
require "active_resource/railtie" 
require "sprockets/railtie" 
# require "rails/test_unit/railtie" 

if defined?(Bundler) 
    # If you precompile assets before deploying to production, use this line 
    Bundler.require(*Rails.groups(:assets => %w(development test))) 
    # If you want your assets lazily compiled in production, use this line 
    # Bundler.require(:default, :assets, Rails.env) 
end 

module ProductRecall 
    class Application < Rails::Application 

    # Configure the default encoding used in templates for Ruby 1.9. 
    config.encoding = "utf-8" 

    # Configure sensitive parameters which will be filtered from the log file. 
    config.filter_parameters += [:password] 

    # Enable escaping HTML in JSON. 
    config.active_support.escape_html_entities_in_json = true 

    # Enforce whitelist mode for mass assignment. 
    # This will create an empty whitelist of attributes available for mass-assignment for all models 
    # in your app. As such, your models will need to explicitly whitelist or blacklist accessible 
    # parameters by using an attr_accessible or attr_protected declaration. 
    config.active_record.whitelist_attributes = true 

    # Enable the asset pipeline 
    config.assets.enabled = true 

    # Version of your assets, change this if you want to expire all your assets 
    config.assets.version = '1.0' 
    config.action_mailer.default_url_options = { host: 'localhost:3000' } 
    end 
end 

вот мой Gem файл:

source 'https://rubygems.org' 

gem 'rails', '3.2.13' 
gem 'bootstrap-sass', '2.1' 
gem 'bcrypt-ruby', '3.0.1' 
gem 'therubyracer', :platforms => :ruby, :platforms => :ruby 
gem 'faker', '1.0.1' 
gem 'will_paginate', '3.0.3' 
gem 'bootstrap-will_paginate', '0.0.6' 
gem 'bootstrap-datepicker-rails' 
gem "google_visualr", "~> 2.1.0" 
gem 'twitter-bootstrap-rails' 
gem "galetahub-simple_captcha", :require => "simple_captcha" 
gem 'rufus-scheduler' 

group :development, :test do 
    gem 'sqlite3', '1.3.5' 
    gem 'rspec-rails', '2.11.0' 
end 

group :development do 
    gem 'annotate', '2.5.0' 
end 

group :assets do 
    gem 'sass-rails', '3.2.5' 
    gem 'coffee-rails', '3.2.2' 
    gem 'uglifier', '1.2.3' 
end 

gem 'jquery-rails', '2.0.2' 

group :test do 
    gem 'capybara', '1.1.2' 
    gem 'factory_girl_rails', '4.1.0' 
    gem 'cucumber-rails', '1.2.1', :require => false 
    gem 'database_cleaner', '0.7.0' 
end 

#gem 'jquery-ui-rails' 

group :production do 
    gem 'pg', '0.12.2' 
end 

плз, дайте мне знать, что здесь не так. так как я ужасно застрял без подсказки с 2 дней

+0

Лучший способ решить проблему, как это удалить функциональность, пока вы не получите это работает. Я предполагаю, что это, вероятно, проблема с Gem, но вы можете сказать только при тестировании –

+0

означает, что я должен удалить драгоценные камни, которые я не использую в своем приложении? –

+0

Я имел в виду, что вы должны временно отключить все, что сможете, до тех пор, пока не найдете, что вызывает ошибку, а затем выполните работу по устранению этой конкретной проблемы. –

ответ

1

У меня также была та же проблема. На самом деле драгоценный камень становится конфликтом. Вот преступник «rufus-scheduler». Попытайтесь удалить драгоценный камень и развернуть.

Далее вы можете попробовать это

task :precompile, :roles => :web, :except => { :no_release => true } do 
    run_locally("rm -rf public/assets/*") 
    run_locally("bundle exec rake assets:precompile") 
    servers = find_servers_for_task(current_task) 
    port_option = port ? " -e 'ssh -p #{port}' " : '' 
    servers.each do |server| 
    run_locally("rsync --recursive --times --rsh=ssh --compress -- 
    human-readable #{port_option} --progress public/assets #{user} @#{server}:   {shared_path}") 
    end 
end 
Смежные вопросы