I'm trying to compile my assets in order to put my project into production.
When executing this command:
rake assets:precompile --trace RAILS_ENV=production
I get the following error:
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
ExecJS::ProgramError: identifier ' (function(options) {
function comments(option) {
if (Object' undefined
(execjs):1
/usr/local/bundle/gems/execjs-2.6.0/lib/execjs/duktape_runtime.rb:29:in `call_prop'
/usr/local/bundle/gems/execjs-2.6.0/lib/execjs/duktape_runtime.rb:29:in `call'
/usr/local/bundle/gems/uglifier-2.7.2/lib/uglifier.rb:212:in `run_uglifyjs'
/usr/local/bundle/gems/uglifier-2.7.2/lib/uglifier.rb:179:in `compile'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/uglifier_compressor.rb:52:in `call'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/uglifier_compressor.rb:28:in `call'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/base.rb:66:in `find_asset'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:134:in `block in find'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:133:in `each'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:133:in `find'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:168:in `compile'
/usr/local/bundle/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/usr/local/bundle/gems/sprockets-3.5.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/usr/local/bundle/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/bundle/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/usr/local/bundle/bin/rake:16:in `load'
/usr/local/bundle/bin/rake:16:in `<main>'
Duktape::ReferenceError: identifier ' (function(options) {
function comments(option) {
if (Object' undefined
/usr/local/bundle/gems/execjs-2.6.0/lib/execjs/duktape_runtime.rb:29:in `call_prop'
/usr/local/bundle/gems/execjs-2.6.0/lib/execjs/duktape_runtime.rb:29:in `call'
/usr/local/bundle/gems/uglifier-2.7.2/lib/uglifier.rb:212:in `run_uglifyjs'
/usr/local/bundle/gems/uglifier-2.7.2/lib/uglifier.rb:179:in `compile'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/uglifier_compressor.rb:52:in `call'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/uglifier_compressor.rb:28:in `call'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/base.rb:66:in `find_asset'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:134:in `block in find'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:133:in `each'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:133:in `find'
/usr/local/bundle/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:168:in `compile'
/usr/local/bundle/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/usr/local/bundle/gems/sprockets-3.5.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/usr/local/bundle/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/bundle/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/bundle/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/usr/local/bundle/bin/rake:16:in `load'
/usr/local/bundle/bin/rake:16:in `<main>'
Tasks: TOP => assets:precompile
Whats happening? Am I compiling assets in the right way?
this my Javascript within the comments:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap-sprockets
//= require ckeditor/init
//= require_tree .
this is the error when open the page in the browser:
(index):21 GET http://dev.nutrimais.com.br/assets/application-c69ac193f2f610776253a81e6da332ce0bb1141cac0141b0d50c686d872126a5.css
application-541957df4066a1b6e019883423b470301accf44038125390a3908dcf374e1a2b.js:1 Uncaught Error: ExecJS::ProgramError: identifier ' (function(options) {
function comments(option) {
if (Object' undefined
(in (execjs):1)(anonymous function) # application-541957df4066a1b6e019883423b470301accf44038125390a3908dcf374e1a2b.js:1
(index):54 Uncaught ReferenceError: $ is not defined(anonymous function) # (index):54
(index):151 Uncaught ReferenceError: $ is not defined
Just discovered that if I use rake assets:precompile --trace it compiles. But using the rake assets:precompile --trace RAILS_ENV=production it gives me the errors
Put it in your gemfile:
group :production do
gem 'therubyracer'
end
You have a bug in your Javascript within the comments function. Fix that and the app will compile! Im happy to take a look if you can post that function.
Related
If I add just the following lines to my config/initializers/assets.rb on Rails 5.1 I get an asset compilation error:
assets = Rails.application.config.assets
assets.version = '1.0'
assets.paths << Rails.root.join('node_modules')
Of course, this file did contain more lines, but I've stripped it right back as part of trying to debug this. I've also emptied the application.coffee and application.scss files of all content.
This is the compilation error with --trace and RAILS_ENV=production
** Execute assets:precompile
I, [2019-07-26T19:58:48.269791 #86008] INFO -- : Writing /Users/samuelstickland/development/hubbado_core/public/assets/application-f78f0f583e152fa235ca51f99bab70d1aeb59675de57c78bcef18b5a2e8a5a5f.js
I, [2019-07-26T19:58:48.271029 #86008] INFO -- : Writing /Users/samuelstickland/development/hubbado_core/public/assets/application-f78f0f583e152fa235ca51f99bab70d1aeb59675de57c78bcef18b5a2e8a5a5f.js.gz
rake aborted!
ExecJS::RuntimeError: SyntaxError: Unexpected token: operator (>)
JS_Parse_Error.get ((execjs):3538:621)
(execjs):4060:48
(execjs):1:102
Object.<anonymous> ((execjs):1:120)
Module._compile (internal/modules/cjs/loader.js:689:30)
Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Module.load (internal/modules/cjs/loader.js:599:32)
tryModuleLoad (internal/modules/cjs/loader.js:538:12)
Function.Module._load (internal/modules/cjs/loader.js:530:3)
Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/uglifier-3.2.0/lib/uglifier.rb:195:in `run_uglifyjs'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/uglifier-3.2.0/lib/uglifier.rb:157:in `compile'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:53:in `call'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:28:in `call'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/samuelstickland/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:83:in `block in run'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/lib/rake/application.rb:80:in `run'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/bin/rake:23:in `load'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/bin/rake:23:in `<main>'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
/Users/samuelstickland/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => assets:precompile
I am completely stumped as to where this error could be coming from given that I wouldn't expect anything to be compiled as a result of the empty application.coffee/scss, except images.
In fact, after running an assets:precompile without the node_modules includes I get only the following JS and CSS files:
$ find ./public/assets/ -name "*.js"
./public/assets//application-f78f0f583e152fa235ca51f99bab70d1aeb59675de57c78bcef18b5a2e8a5a5f.js
./public/assets//active_admin-f78f0f583e152fa235ca51f99bab70d1aeb59675de57c78bcef18b5a2e8a5a5f.js
These are both 'empty', only containing (function(){}).call(this);
$ find ./public/assets/ -name "*.css"
./public/assets//active_admin/print-ef81b6a45bca13d9584a56677a4cc64d9cb053c768465f43ef448caf6f220216.css
./public/assets//active_admin-c1ac2e411944e447bcbf94ec2d97a0f2825ec0153bcbda2925f69da7ea6db226.css
./public/assets//application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css
Here the application.css asset is completely empty. The active admin files have a lot of CSS in though.
With node_modules in the assets path leads to the syntax error shown above.
OK, so it turns out that sprockets will hungrily process any JS it finds in a directory named application!
I found this by changing my uglifier to handle ES6 syntax:
config.assets.js_compressor = Uglifier.new(harmony: true)
And then discovered that the assets compile had produced another JS file:
./public/assets//#schematics/angular/application/index-7cb879a643459c580f46b4127272b2918753e9941c074dcf27faea589ca610de.js
./public/assets//application-f78f0f583e152fa235ca51f99bab70d1aeb59675de57c78bcef18b5a2e8a5a5f.js
The file is coming from here:
$ find ./node_modules/ | grep -E "application/.*.js$"
./node_modules//#schematics/angular/application/index.js
./node_modules//#schematics/angular/application/files/karma.conf.js
./node_modules//#schematics/angular/application/files/protractor.conf.js
I'm getting the following error on my rails app when I try to precompile the assets. With a trace it says the following:
$ RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
ArgumentError: Unmatched double quote: "asset_path \"favicon.ico\" %>',"
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/2.3.0/shellwords.rb:83:in `block in shellsplit'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/2.3.0/shellwords.rb:81:in `scan'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/2.3.0/shellwords.rb:81:in `shellsplit'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/directive_processor.rb:142:in `block in extract_directives'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/directive_processor.rb:140:in `each'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/directive_processor.rb:140:in `each_with_index'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/directive_processor.rb:140:in `extract_directives'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/directive_processor.rb:117:in `process_source'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/directive_processor.rb:82:in `_call'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/directive_processor.rb:68:in `call'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/bundle.rb:23:in `block in call'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/utils.rb:196:in `dfs'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/bundle.rb:24:in `call'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/base.rb:66:in `find_asset'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:134:in `block in find'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:133:in `each'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:133:in `find'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:185:in `compile'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.0/lib/rake/sprocketstask.rb:147:in `with_logger'
/Users/admin/projects/RoR/bubblin/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
Splitting the trace here because stackoverflow wants more words over "code."
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/task.rb:248:in `block in execute'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/task.rb:243:in `each'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/task.rb:243:in `execute'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/task.rb:173:in `invoke'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:152:in `invoke_task'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:108:in `each'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:108:in `block in top_level'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:117:in `run_with_threads'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:102:in `top_level'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:80:in `block in run'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:77:in `run'
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/Users/admin/.rbenv/versions/2.3.1/bin/rake:22:in `load'
/Users/admin/.rbenv/versions/2.3.1/bin/rake:22:in `<main>'
Tasks: TOP => assets:precompile
Weird; leave it for a month and something breaks in the meantime.
This seems to be a very awkward error. There are a lots of problems with rake asset:precompile but i didn't find nothing similar to this issue having Sass syntax error.I dont know what file this error occurs.
i'm using rails 5.
root#006230dae323:~/myhomerails# rake assets:precompile --trace RAILS_ENV=production
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
Sass::SyntaxError: Invalid CSS after " color: ": expected expression (e.g. 1px, bold), was ";"
(sass):13586
this is the rest of the log:
rake aborted!
Sass::SyntaxError: Invalid CSS after " color: ": expected expression (e.g. 1px, bold), was ";"
(sass):13586
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:1189:in `expected'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/script/lexer.rb:229:in `expected!'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/script/parser.rb:704:in `assert_expr'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/script/parser.rb:75:in `parse'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:1051:in `sass_script'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:897:in `value!'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:769:in `block in try_declaration'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:1165:in `call'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:1165:in `rethrow'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:782:in `try_declaration'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:711:in `declaration_or_ruleset'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:676:in `block_child'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:665:in `block_contents'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:657:in `block'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:649:in `ruleset'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:675:in `block_child'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:668:in `block_contents'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:125:in `stylesheet'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/scss/parser.rb:41:in `parse'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/engine.rb:406:in `_to_tree'
/usr/local/bundle/gems/sass-3.4.22/lib/sass/engine.rb:281:in `render'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/sass_compressor.rb:48:in `call'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/sass_compressor.rb:28:in `call'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `yield'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/base.rb:66:in `find_asset'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:142:in `block in find'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `each'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `each'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `logical_paths'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:140:in `find'
/usr/local/bundle/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:185:in `compile'
/usr/local/bundle/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/usr/local/bundle/gems/sprockets-3.7.0/lib/rake/sprocketstask.rb:147:in `with_logger'
/usr/local/bundle/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/task.rb:248:in `call'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/task.rb:248:in `block in execute'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/task.rb:243:in `each'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:152:in `invoke_task'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:108:in `each'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:108:in `block in top_level'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:117:in `run_with_threads'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:102:in `top_level'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:80:in `block in run'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling'
/usr/local/bundle/gems/rake-11.3.0/lib/rake/application.rb:77:in `run'
/usr/local/bundle/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/rake:17:in `load'
/usr/local/bundle/bin/rake:17:in `<main>'
Tasks: TOP => assets:precompile
For some reason bin read cannot read the an image file form the standard assets directory and is failing with the following message:
C:\Users\username\Documents\project>bundle exec rake assets:precompile
RAILS_ENV=development --trace
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
I, [2015-08-20T16:43:52.031167 #2664] INFO -- : Writing C:/Users/username/Documents/project/public/assets/xxx-5e3812eb433519f2816f938f5c3512a8a272644bd73273a3680ceb6f625b701a.png
rake aborted!
Errno::EINVAL: Invalid argument # rb_sysopen - C:/Users/username/Documents/project/C:/Users/username/Documents/project/app/assets/images/xxx.png
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/asset.rb:99:in `binread'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/asset.rb:99:in `source'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/asset.rb:166:in `block in write_to'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:274:in `block in atomic_write'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:273:in `open'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:273:in `atomic_write'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/asset.rb:165:in `write_to'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:186:in `block in compile'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:139:in `block (2 levels) in find'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/base.rb:76:in `find_all_linked_assets'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:138:in `block in find'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:223:in `block in stat_tree'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:207:in `block in stat_directory'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:204:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:204:in `stat_directory'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:222:in `stat_tree'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:105:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:104:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:104:in `logical_paths'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:136:in `find'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:162:in `compile'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/rake/sprocketstask.rb:147:in `with_logger'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in`<top (required)>'
C:/RailsInstaller/Ruby2.1.0/bin/rake:23:in `load'
C:/RailsInstaller/Ruby2.1.0/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile
I found the solution: it turns out that the internal asset cache in sprockets gem somehow got corrupted file names and as a result the link to the actual image file was causing an exception. Use the following application config setting to flush the cache and overcome this: # Version of your assets, change this if you want to expire all your assets config.assets.version = 'v.2'
I am hitting a
rake aborted!
undefined method `mtime' for nil:NilClass
error when trying to precompile a Rails / Joosy / Foundation 4 app with Phusion Passenger.
The command I am using is
bundle exec rake assets:precompile
I have tried grep -r "mtime" which took forever and didn't seem to return anything (although I didn't let it finish) and a search of my local files for the same term returned nothing.
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
Rails 3.2.13
Phusion Passenger version 4.0.2
The full trace is as follows. Anything else that might be useful please let me know.
Thanks.
$ bundle exec rake assets:precompile
/home/entracked/.rvm/rubies/ruby-1.9.3-p392/bin/ruby /home/entracked/.rvm/gems/ruby- 1.9.3-p392#global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
undefined method `mtime' for nil:NilClass
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:128:in `block in build_dependency_paths'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:127:in `build_dependency_paths'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:17:in `initialize'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `new'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `block in build_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:270:in `circular_call_protection'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:248:in `build_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:16:in `initialize'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2 .2.2/lib/sprockets/index.rb:92:in `build_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:19:in `block in compile'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:18:in `compile'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/actionpack-3.2.13/lib/sprockets/assets.rake:56:in `internal_precompile'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/actionpack-3.2.13/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
Command failed with status (1): [/home/entracked/.rvm/rubies/ruby-1.9.3-p39...]
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `call'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `sh'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `sh'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/file_utils.rb:80:in `ruby'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `ruby'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/actionpack-3.2.13/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/actionpack-3.2.13/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#global/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/bin/ruby_noexec_wrapper:14:in `eval'
/home/entracked/.rvm/gems/ruby-1.9.3-p392#hub_blog/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile
EDIT
So further reading makes me thing it is related to https://github.com/sstephenson/sprockets/issues/141 which basically says the error message are not very useful, but that is probably related to the require_tree manifest in application.js.
I'm not very sure what is going on but I wonder if there is something missing from mine
//= require jquery
//= require jquery_ujs
//= require foundation
//= require_tree .
$(document).foundation();
also tried adding this line
//= require_tree ./blog
because I have a joosy.ws (front end js framework) application created in assets/javascripts/blog. Not sure if this will be included by default. Neither option seems to fix the issue.