3

I'm new in rails and I have small project , when I push to heroku see this error

Counting objects: 41, done.
Delta compression using up to 4 threads.

Compressing objects: 100% (26/26), done.
Writing objects: 100% (26/26), 2.21 KiB | 0 bytes/s, done.
Total 26 (delta 19), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-1.9.3
remote: ###### WARNING:
remote:        Removing `Gemfile.lock` because it was generated on Windows.
remote:        Bundler will do a full resolve so native gems are handled properl
remote:        This may result in unexpected gem versions being used in your app
remote:        In rare occasions Bundler may not be able to resolve your depende
remote:        https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: -----> Installing dependencies using 1.6.3
remote:        Running: bundle install --without development:test --path vendor/
e/bin -j4
remote:        Fetching gem metadata from https://rubygems.org/..........
remote:        Resolving dependencies...
remote:        Using rake 10.4.2
remote:        Using i18n 0.6.11
remote:        Using json 1.8.1
remote:        Using minitest 5.5.0
remote:        Using thread_safe 0.3.4
remote:        Using builder 3.2.2
remote:        Using rack 1.5.2
remote:        Using erubis 2.7.0
remote:        Using mime-types 2.4.3
remote:        Using arel 5.0.1.20140414130214
remote:        Using browser 0.8.0
remote:        Using bundler 1.6.3
remote:        Using coffee-script-source 1.8.0
remote:        Using execjs 2.2.2
remote:        Using thor 0.19.1
remote:        Using hike 1.2.3
remote:        Using multi_json 1.10.1
remote:        Using pg 0.17.1
remote:        Using tilt 1.4.1
remote:        Using rails_serve_static_assets 0.0.2
remote:        Using sass 3.2.19
remote:        Using tzinfo 1.2.2
remote:        Using rack-test 0.6.2
remote:        Using coffee-script 2.3.0
remote:        Using rdoc 4.2.0
remote:        Using rails_stdout_logging 0.0.3
remote:        Using mail 2.6.3
remote:        Using activesupport 4.1.8
remote:        Using sprockets 2.12.3
remote:        Using uglifier 2.6.0
remote:        Using rails_12factor 0.0.3
remote:        Using actionview 4.1.8
remote:        Using activemodel 4.1.8
remote:        Using jbuilder 2.2.5
remote:        Using sdoc 0.4.1
remote:        Using actionpack 4.1.8
remote:        Using railties 4.1.8
remote:        Using actionmailer 4.1.8
remote:        Using coffee-rails 4.0.1
remote:        Using sprockets-rails 2.2.2
remote:        Using activerecord 4.1.8
remote:        Using jquery-rails 3.1.2
remote:        Using turbolinks 2.5.3
remote:        Using sass-rails 4.0.5
remote:        Using rails 4.1.8
remote:        Your bundle is complete!
remote:        Gems in the groups development and test were not installed.
remote:        It was installed into ./vendor/bundle
remote:        Bundle completed (6.79s)
remote:        Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        NoMethodError: undefined method `application' for Ruby3arabi:Modu
remote:        /tmp/build_d0f2bbb7ea12174ddc6ffbb7396c02ae/config/environment.rb
remote:        /tmp/build_d0f2bbb7ea12174ddc6ffbb7396c02ae/vendor/bundle/ruby/1.
ib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_d0f2bbb7ea12174ddc6ffbb7396c02ae/vendor/bundle/ruby/1.
ib/active_support/dependencies.rb:247:in `block in require'
remote:        /tmp/build_d0f2bbb7ea12174ddc6ffbb7396c02ae/vendor/bundle/ruby/1.
ib/active_support/dependencies.rb:232:in `load_dependency'
remote:        /tmp/build_d0f2bbb7ea12174ddc6ffbb7396c02ae/vendor/bundle/ruby/1.
ib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_d0f2bbb7ea12174ddc6ffbb7396c02ae/vendor/bundle/ruby/1.
ils/application.rb:276:in `require_environment!'
remote:        /tmp/build_d0f2bbb7ea12174ddc6ffbb7396c02ae/vendor/bundle/ruby/1.
ils/application.rb:389:in `block in run_tasks_blocks'
remote:        /tmp/build_d0f2bbb7ea12174ddc6ffbb7396c02ae/vendor/bundle/ruby/1.
/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
remote:        Tasks: TOP => environment
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:
remote:  !     Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to ruby3arabi.
remote:
To https://git.heroku.com/ruby3arabi.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/ruby3arabi.git'

I'm using mruby in my project < And when I remove mruby files push not fail

And my second problem I'm use script tag in my page and it's not work

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>

I don't have this problem in localhost but only when I push

Anyone can help me ?

This is 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

  # 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 Rails's static asset server (Apache or nginx will already do this).
  config.serve_static_assets = true

  # 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

  # Generate digests for assets URLs.
  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

  # Set to :debug to see everything in the log.
  config.log_level = :info

  # 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

  # Disable automatic flushing of the log to improve performance.
  # config.autoflush_log = false

  # 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
end

And this is application.rb

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

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Ruby3arabi
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

environment.rb

# Load the Rails application.
require File.expand_path('../application', __FILE__)

# Initialize the Rails application.
Rails.application.initialize!
AliOsm
  • 541
  • 2
  • 6
  • 20
  • I'm not familiar with your environment, but what happens if you run "bundle exec rake asset:precompile" instead of just "rake..." – SnakeWasTheNameTheyGaveMe Dec 20 '14 at 14:54
  • Can you post the contents of `config/environment.rb`? – fivedigit Dec 20 '14 at 14:59
  • @fivedigit || I'm add environment.rb contents – AliOsm Dec 20 '14 at 17:07
  • @JakeTheSnake || I'm get this error when run your line : "Don't know how to build task 'asset:precompile'" – AliOsm Dec 20 '14 at 17:08
  • My bad, that was a typo; I was missing an "s" after "asset". Also, have you googled this problem? "rake NoMethodError: undefined method `application'"...there are some results there to check out. http://stackoverflow.com/questions/23857986/rails-nomethoderror-undefined-method-configure-for-firstapp – SnakeWasTheNameTheyGaveMe Dec 20 '14 at 23:44

1 Answers1

2

try to rake assets:precompile manually in dev maybe theres an error that mruby considers as a reason to not push :D

  • when I run your command all css and js files doesn't work in my site – AliOsm Dec 20 '14 at 17:14
  • is there an error while using the command ? post here result :) – Lucas Sirignano Dec 20 '14 at 17:43
  • no errors when run the command put all my css and js files doesn't work in site when I push to heroku and when I run the command I have new folder "assets" in "public" folder , any other information – AliOsm Dec 20 '14 at 18:07
  • Ok i think i cant help you that much, BUT, try to add that gems : gem 'rails_12factor', group: :production in your gemfile. You can see why here : https://devcenter.heroku.com/articles/rails-4-asset-pipeline – Lucas Sirignano Dec 20 '14 at 18:34
  • I actually use that gem , I'm try to solve this problem before two weeks >_ – AliOsm Dec 20 '14 at 19:18
  • soz bro, i cant help you that much, last time i had a simillar error, i just deleted all assets and public folders on production server then repush manually precompile assets (with rake assets:precompile then git add public, etc ...) But this is probably not a smart way to understand this issue – Lucas Sirignano Dec 20 '14 at 19:44
  • When you say you're using the script tag in "your page", do you mean the application layout? Also, can you tell me the information from the logs? ```heroku logs``` – damianesteban Dec 25 '14 at 22:21
  • running rake assets:precompile helped me find the issue why it wasn't precompiling but you shouldn't have to do this :D – Babbz77 Dec 03 '17 at 06:23