Rails 3.2 js not loading in production - ruby-on-rails

I am restoring an app from a backup on rails 3.2. The app is using spree with a custom template.
In development, it works fine but in production I got js error in console:
Uncaught TypeError: $(...).slides is not a function
All javascripts break.
I have tried any possible fix like clean and recompile assets or update bundle.
production.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 = false
On Gemfile, among other things I have
gem 'jquery-rails'
# Gems used only for assets and not required
# in production environments by default.
gem 'sass', '3.2.7'
group :assets do
gem 'sass-rails', '~> 3.2.6'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'execjs'
gem 'uglifier', '>= 1.0.3'
end
Any suggestions about where I could look?

See what the .slides error is about, off the top of my head it could be a missing jquery plugin that you throw into vendor/js/ and require in the pipeline.

Related

uninitialized constant Paperclip::Storage::S3::AWS. I am getting this error when i am trying to upload an image to aws-s3 using paperclip

Gemfile
source 'http://rubygems.org'
gem 'rails', '4.2.4'
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
gem 'searchkick'
gem 'cocoon'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'foundation-rails'
gem 'tinymce-rails', '~> 4.3', '>= 4.3.8'
gem 'haml'
gem 'font-awesome-rails', '~> 4.6', '>= 4.6.1.0'
gem 'simple_form'
gem 'paperclip', '~> 4.3', '>= 4.3.6'
gem 'omniauth-facebook'
gem 'acts_as_votable'
gem 'masonry-rails', '~> 0.2.4'
gem 'aws-sdk', '~> 2.2', '>= 2.2.35'
gem 'foreman'
gem 'puma'
gem 'omniauth'
gem 'jquery-turbolinks', '~> 2.1'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
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 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 = false
# 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.paperclip_defaults = {
storage: :s3,
:s3_region => ENV['AWS_REGION'],
s3_credentials: {
bucket: ENV['S3_BUCKET_NAME'],
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
}
}
end
paperclip.rb
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = ":class/:attachment/:id_partition/:style/:filename"
Paperclip::Attachment.default_options[:s3_host_name] = 's3-us-west-2.amazonaws.com'
Details of Problem
*Problem is that when we use aws-sdk ~>2.0 Shows above error in the title while I am uploading image using paperclip for my heroku app. There is similar question but answer to that question is valid now as gem 'aws-sdk','~<2.0' is depracted now. It give corrupted gem error when tried to install. I am stuck in this for 2 days. Couldn't find any satisfactory answer from any resource. Thank you in advance *

Paperclip with S3 working fine on Localhost but Giving Error on Heroku

Gemfile
source 'http://rubygems.org'
gem 'rails', '4.2.4'
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
gem 'searchkick'
gem 'cocoon'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'foundation-rails'
gem 'tinymce-rails', '~> 4.3', '>= 4.3.8'
gem 'haml'
gem 'font-awesome-rails', '~> 4.6', '>= 4.6.1.0'
gem 'simple_form'
gem 'paperclip', '~> 4.3.6'
gem 'omniauth-facebook'
gem 'acts_as_votable'
gem 'masonry-rails', '~> 0.2.4'
gem 'aws-sdk', '~> 1.66.0'
gem 'foreman'
gem 'puma'
gem 'omniauth'
gem 'jquery-turbolinks', '~> 2.1'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
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 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 = false
# 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.paperclip_defaults = {
:storage => :s3,
:s3_protocol => 'http',
:s3_credentials => {
:bucket => ENV['S3_BUCKET_NAME'],
:access_key_id => ENV['AWS_ACCESS_KEY'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
end
Paperclip.rb
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
I am running into this error
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
Image uploading is working Perfectly fine on localhost.I don't why It is giving this error on Heroku. I checked the credentail config environment variable,they are correct.No problem with them.Even with heroku logs,Nothing else could be deduce rather than status:500. Can someone help me out to either get Full error message for heroku logs for knowing error or Let me know what is wrong with above code. Thanx a lott in advance
Here are some helpful debugging settings for your Heroku app.
In production.rb:
# More meaningful logs
config.log_level = :debug
# More meaningful error pages
config.consider_all_requests_local = true
I figured out Error by setting:
Production.rb
# More meaningful logs
config.log_level = :debug
# More meaningful error pages
config.consider_all_requests_local = true
In my case there was problem with :s3_region,I fixed it by config ENV variable for heroku
heroku config:set AWS_REGION=us-east-1

RailsBridge "bundle install --without production" Error

In step Step 2.2 (Prepare your rails app for deploying to Heroku) of RailsBridge, you are prompted to type this in the terminal:
bundle install --without production
Unfortunately, it is printing out an error reading "The system cannot find the path specified." It then proceeds to tell you that if you given this error to ask for a volunteer to help you edit the config/environments/production.rb. StackOverflow, you are my volunteer! Please help, you're my only hope.
Here is the code in "Gemfile":
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.2'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
# 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
# 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'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
And here is the code in "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 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 = false
# 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
end
In advance, thanks to whoever decides to help out!
Missing the
gem 'puma', '~> 3.0' line

Heroku Precompiling Assets Failed

My app is suddenly not working after an update. Not sure what's going wrong. Basically, when I push to heroku, I get these errors:
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
And a little higher up:
rake aborted!
Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247)
Error
at new JS_Parse_Error (/tmp/execjs20121211-811-1z5vum.js:1720:22)
at js_error (/tmp/execjs20121211-811-1z5vum.js:1728:15)
at croak (/tmp/execjs20121211-811-1z5vum.js:2189:17)
at token_error (/tmp/execjs20121211-811-1z5vum.js:2196:17)
at unexpected (/tmp/execjs20121211-811-1z5vum.js:2202:17)
at /tmp/execjs20121211-811-1z5vum.js:2580:17
at maybe_unary (/tmp/execjs20121211-811-1z5vum.js:2665:27)
at expr_op (/tmp/execjs20121211-811-1z5vum.js:2685:45)
at expr_ops (/tmp/execjs20121211-811-1z5vum.js:2692:24)
at maybe_conditional (/tmp/execjs20121211-811-1z5vum.js:2696:28)
When I actually load up the site ("We're sorry, but something went wrong"), and look at the heroku logs, I get this:
Load path: /app
2012-12-11T23:18:13+00:00 app[web.1]: 8: <%= stylesheet_link_tag "application", :media => "all" %>
2012-12-11T23:18:13+00:00 app[web.1]: (in /app/app/assets/stylesheets/custom.css.scss)):
2012-12-11T23:18:13+00:00 app[web.1]: 6: <link href='http://fonts.googleapis.com/css?family=Kreon' rel='stylesheet' type='text/css'>
2012-12-11T23:18:13+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: bootstrap.
2012-12-11T23:18:13+00:00 app[web.1]: 5: <title><%= full_title(yield(:title)) %></title>
2012-12-11T23:18:13+00:00 app[web.1]: 7: <%= favicon_link_tag 'favicon.ico' %>
2012-12-11T23:18:13+00:00 app[web.1]: 10: <%= csrf_meta_tags %>
2012-12-11T23:18:13+00:00 app[web.1]: app/assets/stylesheets/custom.css.scss:1
2012-12-11T23:18:13+00:00 app[web.1]: 11: <meta name="google-site-verification" content="idIPkgRBikSL9PCS4rVkkZfRjxYbPxNbyF6tVymBWbc" />
2012-12-11T23:18:13+00:00 app[web.1]:
2012-12-11T23:18:13+00:00 app[web.1]:
(Kreon is an additional font I added a while back that's been working fine. custom.css.scss is my main css file, and the first line is where I import bootstrap in a way that hasn't changed and has worked forever).
I searched for how to deal with the "File to import not found or unreadable: bootstrap" error, and landed on this discussion and checked out the relevant heroku troubleshoot page, but changing assets.compile to true in my production.rb file led to the heroku push errors above, and the troubleshoot page didn't seem to have much relevant to my specific problem. Not really sure what's going on here, so I'm just going to put a bunch of possibly relevant code below.
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'googlecharts', :require => "gchart"
gem 'unicorn'
gem 'newrelic_rpm'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :production do
gem 'pg'
end
group :development do
gem 'sqlite3'
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '1.2.1'
end
group :test do
gem 'capybara', '1.1.2'
gem 'rb-fsevent', '0.9.1'
gem 'growl', '1.0.3'
gem 'guard-spork', '1.2.0'
gem 'spork', '0.9.2'
gem 'factory_girl_rails', '4.1.0'
end
gem 'annotate', '2.5.0'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'roadie'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'delayed_job_active_record'
gem 'daemons'
gem 'foreman'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
production.rb
MyApp::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
# Force all access to the app over SSL, use Strict-Transport-Security,
# and use secure cookies.
config.force_ssl = 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 = false
# 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
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# 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
# See everything in the log (default is :info)
# 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"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# 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
end
The line that's really throwing me is this one in my heroku push log:
Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247)
The issue, is I have no idea what file to look in for this troublesome ">". Any ideas how to read that line/col/pos nomenclature to find the actual offending code snippet?
Thanks.
STart with line 1 of app/assets/stylesheets/custom.css.scss and look for an errant >.
Also look to make sure that application.scss is what you expect.
Also just rename custom.css.scss to justcustom.scss Heck, that may do it.
Try this in the terminal:
rake assets:precompile RAILS_ENV=production --trace
Better than trying to push on heroku.
I just had the same errors.
The problem was:
the config.secret_key of devise was commented
syntax_error in a javascript file ( an "of" instead of an "in" in a for loop)
The same thing happened to me as well,
"Precompiling assets failed." while pushing to heroku,
In my development environment I had an error in my css:
".........
cursor: pointer
color: #808080;"
missing the ";" after the "pointer",
the development environment didn't mind the error,
but Heroku's PreCompile task did.
Some other Problems might be caused by duplicate named file, with "css" and "css.scss" suffixes.

asset pipeline not working on production, tried everythign

I have a rails 3.2 app on heroku. I have tried everything I can find to try to fix the fact that the javascripts are not loading in production mode. Everything works fine in dev though. Also, when deploying to heroku, the precompiling fails. However, when I look at the source code in prod, I can clearly see the javascripts file (/assets/application-32fdbd115c5d59c7be2876c103063600.js) loading and has content.
I have tried every setting I can think of and have read about. I am not quite sure what to do. Here's my setup currently in production.rb:
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.compress = false
config.assets.compile = true
config.assets.digest = true
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
and in environment.rb:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
App::Application.initialize!
application.rb:
require File.expand_path('../boot', __FILE__)
require "rails/all"
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 App
class Application < Rails::Application
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
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'
and my gemfile:
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'mysql2'
gem 'thin'
gem 'activerecord-postgresql-adapter'
gem 'devise'
gem 'paperclip', '~> 3.0'
gem 'haml'
gem 'activeadmin'
gem "meta_search", '>= 1.1.0.pre'
gem 'aws-sdk', '~> 1.3.4'
gem 'acts_as_list'
gem 'stripe'
gem 'sass-rails', '~> 3.2.3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'twitter-bootstrap-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :development do
gem 'debugger'
end
nothing I do seems to get it to work on production mode on my local machine or on heroku. however, it works just fine in development.
I finally figured out how to fix this, although I don't know how good of a fix it is. Basically, the problem was that the compression of the .js files into application.js was causing issues. In production.rb I put this:
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = false
# 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
config.assets.debug = true
this fixed the issue. however, now instead of application.js, it lists all the asset files. i'm not sure if there are any long-term issues with this.
On your production box have you tried: RAILS_ENV rake assets:precompile

Resources