Getting ExecJS when compiling rassets:precompile against production - ruby-on-rails

So I am running into an odd issue. I cannot precompile assets on Rails 5 against production. I keep getting the same error message, irrespective if I precompile on the server itself or on my local environment.
georg$ RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
ExecJS::RuntimeError: SyntaxError: Unexpected token: name ($)
get#(execjs):3538:630
(execjs):4058:47
(execjs):1:46
global code#(execjs):1:58
/Users/georg/.rvm/gems/ruby-2.2.4/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/uglifier-3.2.0/lib/uglifier.rb:195:in `run_uglifyjs'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/uglifier-3.2.0/lib/uglifier.rb:157:in `compile'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:53:in `call'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:28:in `call'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `yield'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/Users/georg/.rvm/gems/ruby-2.2.4/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/Users/georg/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `eval'
/Users/georg/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
To solve the issue I did the following:
1.) I have a subfolder structure I am referring to under assets/javascript, so I added that to the asset path and I thought that may be the issue - but apparently it isn't. I read the paths in like this:
Dir.glob("#{Rails.root}/app/assets/javascripts/**/").each do |path|
config.assets.paths << path
end
2.) I removed all references from application.js - it is empty and I still get the error.
3.) I removed / added therubyracer
# gem 'therubyracer', platforms: :ruby
4.) I installed and updated the execjs gem independently
5.) Eventually, I was running out of ideas. Given that I get the error when there's nothing to compile.
My environment:
georg$ rails -v
Rails 5.0.5
georg$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin16]
The compiling was done on OSx and Debian.
Any hints are much appreciated!!

The issue was with a custom js file in the tree. Given that there are plenty of js files included in the applciation.js it is obviously a painful way of trial and error to get to the bottom of the issue given the limited information I got from the trace. It would be interesting to know if there are ways to get more information in return to avoid lengthy inefficient debug sessions.
For the time being, I removed all js, added them one-by-one and run a precompile till I hit the offending code.

Related

Add node_modules to the rails asset paths causes an asset compilation error

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

SassC::SyntaxError: Error: Invalid CSS after "}":

I'm trying to precompile + minify my js and css assets.
If I run: rake assets:precompile
Then it runs fine, but doesn't minify.
If I run: SECRET_KEY_BASE=rake secretRAILS_ENV=production rake assets:precompile
Then it returns an error message and doesn't compile: SassC::SyntaxError: Error: Invalid CSS after "}": expected 1 selector or at-rule, was '!function(){if("und' on line 17881 of stdin
I've tried updating various gems, changing some of the CSS, adding #import to application.scss, etc but none of it seems to be working.
Here's the full error message:
rake aborted!
SassC::SyntaxError: Error: Invalid CSS after "}": expected 1 selector or at-rule, was '!function(){if("und'
on line 17881 of stdin
>> }
-^
stdin:17881
/usr/local/rvm/gems/ruby-2.4.1/gems/sassc-2.0.0/lib/sassc/engine.rb:49:in `render'
/usr/local/rvm/gems/ruby-2.4.1/gems/sassc-rails-2.1.0/lib/sassc/rails/compressor.rb:29:in `call'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/sass_compressor.rb:28:in `call'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/usr/local/rvm/gems/ruby-2.4.1#global/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/usr/local/rvm/gems/ruby-2.4.1/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/usr/local/rvm/gems/ruby-2.4.1#global/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
What am I missing that will let it precompile and minify my js and css?
For anyone searching for this, in the end I just deleted two instances in my CSS and JS that included the problematic line (!function(){if().
Still not sure why they caused this error but as they were not actively used lines anyway (related to videos, which I don't currently use) I was happy enough to just delete and compile without them.
I met the same problem.
to solve it, the key is find what is the content of "stdin", so we have to modify your local gem file and add debug outputs:
# edit (/home/siwei/.asdf/installs/ruby/3.0.4/lib/ruby/gems/3.0.0/gems/sassc-rails-2.1.2/lib/sassc/rails/compressor.rb)
def call(*args)
input = if defined?(data)
data # sprockets 2.x
else
args[0][:data] #sprockets 3.x
end
# add these debug lines of code
puts "=== input is: "
File.write('/tmp/temp_scss', input)
puts "=== input end "
SassC::Engine.new(
input,
{
style: :compressed
}
).render
end
then run command:
RAILS_ENV=production bundle exec rails assets:precompile
then you will meet error, no worry, check out the file /tmp/temp_scss, find the "line 17881 of stdin", you will find the syntax error.
e.g. my error looks like:
just fix this bug and everything goes fine.

Capistrano deployment failing on assets:precompile

I have been using capistrano 3 for my rails app for sometime. Today it started failing at assets precompilation step with the following on logs that aren't very helpful:
On the server I have
node 10.12.0
yarn 1.10.1
rails 5.1.6
ruby 2.5.1
rbenv 1.1.1
Caused by:
PrecompileRequired: PrecompileRequired
Caused by:
SSHKit::Command::Failed: ls exit status: 2
ls stdout: ls: cannot access '/var/www/bubblin.io/releases/20181020142819/assets_manifest_backup': No such file or directory
ls stderr: Nothing written
Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as marvin#bubblin.io: rake exit status: 1
rake stdout: Yarn executable was not detected in the system.
Download Yarn at https://yarnpkg.com/en/docs/install
rake aborted!
Autoprefixer doesn’t support Node v5.4.1. Update it.
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/autoprefixer-rails-9.2.1/lib/autoprefixer-rails/processor.rb:163:in `runtime'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/autoprefixer-rails-9.2.1/lib/autoprefixer-rails/processor.rb:37:in `process'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/autoprefixer-rails-9.2.1/lib/autoprefixer-rails/sprockets.rb:20:in `run'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/autoprefixer-rails-9.2.1/lib/autoprefixer-rails/sprockets.rb:14:in `call'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23:in `block in call'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200:in `dfs'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24:in `call'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/context.rb:99:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/context.rb:129:in `depend_on_asset'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/context.rb:160:in `link_asset'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/context.rb:27:in `compute_asset_path'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/actionview-5.1.6/lib/action_view/helpers/asset_url_helper.rb:198:in `asset_path'
/var/www/bubblin.io/releases/20181020145802/app/assets/javascripts/serviceworkers/sw.js.erb:60:in `_evaluate_template'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/erb_processor.rb:26:in `call'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/erb_processor.rb:13:in `call'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23:in `block in call'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200:in `dfs'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24:in `call'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:134:in `block in find'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `each'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `find'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/marvin/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/marvin/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
rake stderr: Nothing written
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:134:in `block in find'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `each'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `find'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/var/www/bubblin.io/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/var/w
DEBUG [709144dc] ww/bubblin.io/shared/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/marvin/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/marvin/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Edit: My yarn.lock file looks like so:
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
Actually, I don't use yarn for anything--was putting up with it because Rails decided to use it by default. I'll be happy we can remove it forever and have the error above be gone with it.
Looks like you don't have yarn installed in your deployment server. Did you already installed it? If not, try this command before a new deploy:
npm install yarn -g

Rake assets in Rails app Heroku

I am trying rake assets:precompile with command "heroku run rake assets:precompile" but I have this error:
Running rake assets:precompile on ⬢ infinite-meadow-50968... up, run.9141 (Free)
yarn install v1.8.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 1.70s.
rake aborted!
Uglifier::Error: Unexpected character '#'
/app/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.10/lib/uglifier.rb:234:in `parse_result'
/app/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.10/lib/uglifier.rb:216:in `run_uglifyjs'
/app/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.10/lib/uglifier.rb:168:in `compile'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/compressing.rb:65:in `block in js_compressor='
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/legacy_proc_processor.rb:31:in `call'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
/app/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Github
Styling on subpages does not work https://infinite-meadow-50968.herokuapp.com/meetups/ See the menu and the section with meetups (in the main page its working)
Can you try to precompile in local? After push it into Heroku. It may be working.
All your js files have wrong syntax for comments. You use # instead of //.
E.g. #= require froala_editor.min.js should be //= require froala_editor.min.js.
You use # for comments in coffee files, and // for js files. Please replace it in all your js files.

Upgrading to Rails 3.2.2: How to solve the 'undefined method for Syck::DomainType' error related to the Delayed Job gem?

I am running Ruby on Rails 3.2.2 from 3.1.0. I have the issue
undefined method send_register_email\' for #<Syck::DomainType:0x0000012d2346b8>\n/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/performable_mailer.rb:6:in perform ...
with the DelayedJob gem that many other people have tried to solve: someone made successfully that, others no. I am in the latter category, also if I tried all solutions I've found on the Web.
At this time, in my Gemfile I have:
gem 'rails', '3.2.2'
gem "rake"
...
gem 'delayed_job_active_record'
...
Before upgrading Rails, in my Gemfile I had:
gem 'rails', '~> 3.1.0'
gem "rake"
...
# I also used the following statement by running Rails 3.2.2 but it didn't work.
gem 'delayed_job'
...
In order to send e-mail messages, in my controllers I use code link the following:
::Users::Mailer.delay.send_register_email(#user)
In my APPLICATION_ROOT/app/mailers/users/mailer.rb file I have:
class Users::Mailer < ActionMailer::Base
...
def send_register_email(user)
...
end
end
Before updating to Rails 3.2.2 all was working as well. Now I get the error mentioned above, in the introduction text. How can I try to solve the Delayed Job issue?
I noted that in the database table related to the delayed_job_active_record gem should be a column named 'queue' (see the "Gory Details" section in the official documentation for more information). However, since I was using gem 'delayed_job' it was present in that database table. Can be that the problem?
Another thing I noted is the following (but I think that isn't the problem, for now):
$ rake jobs:work
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /<ABSOLUTE_PATH>/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /<ABSOLUTE_PATH>/Rakefile:7)
[Worker(host:<MY_USER>.local pid:76826)] Starting job worker
The following is what is present in the DelayedJob last_error database table column:
{undefined method `send_register_email' for #<Syck::DomainType:0x0000010228a840>
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/performable_mailer.rb:6:in `perform'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/backend/base.rb:94:in `block in invoke_job'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `call'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `block in initialize'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `call'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `execute'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/backend/base.rb:91:in `invoke_job'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:162:in `block (2 levels) in run'
/<ABSOLUTE_PATH>/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:58:in `timeout'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:162:in `block in run'
/<ABSOLUTE_PATH>//.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:161:in `run'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:218:in `block in reserve_and_run_one_job'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `block in initialize'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:218:in `reserve_and_run_one_job'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:146:in `block in work_off'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:145:in `times'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:145:in `work_off'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:117:in `block (4 levels) in start'
/<ABSOLUTE_PATH>//.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:116:in `block (3 levels) in start'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `block in initialize'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:113:in `block (2 levels) in start'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:112:in `loop'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:112:in `block in start'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/plugins/clear_locks.rb:7:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:78:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `block in initialize'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:78:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:78:in `block in add'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:111:in `start'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/<ABSOLUTE_PATH>//.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
If you are using bundler try prefixing the script or rake task with "bundle exec" e.g.
bundle exec script/delayed_job -n 2 start
It did the trick for us.
We managed to solve Syck / Psych weirdness in our app by ensuring that setting the YAML parser to Syck was the absolute first thing done when initializing. The reason you can sometimes run into issues is that DelayedJob initializes differently depending on which YAML parser you're using, and if the parser changes during initialization, DelayedJob will probably get it wrong.
Add this to the very top of boot.rb, and see if it helps:
require 'yaml'
YAML::ENGINE.yamler = 'syck'

Resources