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.
Related
yarn install v1.22.19
[1/4] 🔍 Resolving packages...
success Nothing to install.
success Saved lockfile.
✨ Done in 0.12s.
rails aborted!
Uglifier::Error:
/Users/dev/.rvm/gems/ruby-2.7.5/gems/uglifier-4.2.0/lib/uglifier.rb:291:in `parse_result'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/compressing.rb:65:in `block in js_compressor='
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/legacy_proc_processor.rb:31:in `call'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:67:in `block (3 levels) in define'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:66:in `block (2 levels) in define'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/railties-5.2.8.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/railties-5.2.8.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/railties-5.2.8.1/lib/rails/command.rb:48:in `invoke'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/railties-5.2.8.1/lib/rails/commands.rb:18:in `<main>'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/dev/Documents/insta-clone/bin/rails:11:in `<top (required)>'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Users/dev/.rvm/gems/ruby-2.7.5/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/dev/Documents/insta-clone/bin/spring:16:in `<top (required)>'
bin/rails:5:in `load'
bin/rails:5:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Comment this line in config/environments/production.rb
config.assets.js_compressor = :uglifier
It will also resolve Error of Assetpipeline while deploying on Heroku
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 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
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.
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.