Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.8.0 raises ExecJS::ProgramError: TypeError: Cannot read property 'version' of undefined #99

Closed
SuwakoMmh opened this issue May 10, 2021 · 44 comments

Comments

@SuwakoMmh
Copy link

SuwakoMmh commented May 10, 2021

Hi, I don't know much about jekyll or ruby or rails or exec-js
My project won't build with version 2.8.0

here's the traceback :

ExecJS::ProgramError: TypeError: Cannot read property 'version' of undefined
  eval (eval at <anonymous> ((execjs):1:213), <anonymous>:1:10)
  (execjs):1:213
  (execjs):16:14
  (execjs):1:40
  Object.<anonymous> ((execjs):1:58)
  Module._compile (internal/modules/cjs/loader.js:1063:30)
  Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
  Module.load (internal/modules/cjs/loader.js:928:32)
  Function.Module._load (internal/modules/cjs/loader.js:769:14)
  Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
  /usr/lib64/ruby/gems/2.6.0/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:39:in `exec'
  /usr/lib64/ruby/gems/2.6.0/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:21:in `eval'
  /usr/lib64/ruby/gems/2.6.0/gems/execjs-2.8.0/lib/execjs/runtime.rb:64:in `eval'
  /usr/lib64/ruby/gems/2.6.0/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails/processor.rb:170:in `runtime'
  /usr/lib64/ruby/gems/2.6.0/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails/processor.rb:53:in `process'
  /usr/lib64/ruby/gems/2.6.0/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails.rb:16:in `process'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:27:in `block (2 levels) in process'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:23:in `open'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:23:in `block in process'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:20:in `each'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:20:in `process'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-autoprefixer-1.0.2/lib/jekyll-autoprefixer.rb:24:in `block in <top (required)>'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/hooks.rb:103:in `block in trigger'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/hooks.rb:102:in `each'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/hooks.rb:102:in `trigger'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:234:in `write'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:82:in `process'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
  /usr/lib64/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
  /usr/lib64/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
  /usr/lib64/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
  /usr/lib64/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
  /usr/lib64/ruby/gems/2.6.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
  /usr/lib64/ruby/gems/2.6.0/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
  /usr/bin/jekyll:9:in `load'
  /usr/bin/jekyll:9:in `<top (required)>'

I don't know if it's a jekyll issue or an execjs issue, meanwhile we're rolling back to 2.7.0.
Best Regards,
SuwakoMmh.

@victorbnl
Copy link

victorbnl commented May 10, 2021

Note: actually I just noticed it doesn't break jekyll, but its plugin jekyll-autoprefixer

I also created an issue at jekyll-autoprefixer

@vrodokanakis
Copy link

vrodokanakis commented May 10, 2021

I just had the same error during precompilation and we don't use jekyll at all.

ExecJS::ProgramError: TypeError: Cannot read property 'version' of undefined
eval (eval at <anonymous> ((execjs):1:213), <anonymous>:1:10)
(execjs):1:213
(execjs):16:14
(execjs):1:40
Object.<anonymous> ((execjs):1:58)
Module._compile (internal/modules/cjs/loader.js:999:30)
Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
Module.load (internal/modules/cjs/loader.js:863:32)
Function.Module._load (internal/modules/cjs/loader.js:708:14)
Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:39:in `exec'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:21:in `eval'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/execjs-2.8.0/lib/execjs/runtime.rb:64:in `eval'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/autoprefixer-rails-9.4.10.2/lib/autoprefixer-rails/processor.rb:153:in `runtime'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/autoprefixer-rails-9.4.10.2/lib/autoprefixer-rails/processor.rb:36:in `process'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/autoprefixer-rails-9.4.10.2/lib/autoprefixer-rails/sprockets.rb:20:in `run'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/autoprefixer-rails-9.4.10.2/lib/autoprefixer-rails/sprockets.rb:14:in `call'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23:in `block in call'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200:in `dfs'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24:in `call'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:134:in `block in find'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `each'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `find'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/task.rb:67:in `block (3 levels) in define'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/task.rb:66:in `block (2 levels) in define'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:83:in `block in run'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:80:in `run'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/Users/vr/.rbenv/versions/2.6.6/bin/rake:23:in `load'
/Users/vr/.rbenv/versions/2.6.6/bin/rake:23:in `<top (required)>'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/vr/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
/Users/vr/.rbenv/versions/2.6.6/bin/bundle:23:in `load'
/Users/vr/.rbenv/versions/2.6.6/bin/bundle:23:in `<main>'

With 2.7.0 everything is working fine.

@SuwakoMmh SuwakoMmh changed the title Version 2.8.0 breaking jekyll Version 2.8.0 raises ExecJS::ProgramError: TypeError: Cannot read property 'version' of undefined May 10, 2021
@mamhoff
Copy link

mamhoff commented May 10, 2021

This is related to using Ruby < 2.7. If you must stay on Ruby 2.6 or earlier, you probably need to stay on execjs < 2.8. The other option is to upgrade to Ruby 2.7 or above. Adding this here for posterity and anyone else running into that rough error message :)

Two solutions:

  1. Upgrade to Ruby 2.7 or later
  2. Downgrade to execjs 2.7 or earlier.

@victorbnl
Copy link

Well I use ruby 2.7.3

Traceback
Configuration file: /home/---/Documents/colabois.fr/_config.yml
            Source: /home/---/Documents/colabois.fr
       Destination: /home/---/Documents/colabois.fr/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    ------------------------------------------------
      Jekyll 4.2.0   Please append `--trace` to the `build` command 
                     for any additional information or backtrace. 
                    ------------------------------------------------
Traceback (most recent call last):
        43: from /home/---/.rvm/gems/ruby-2.7.3/bin/ruby_executable_hooks:22:in `<main>'
        42: from /home/---/.rvm/gems/ruby-2.7.3/bin/ruby_executable_hooks:22:in `eval'
        41: from /home/---/.rvm/gems/ruby-2.7.3/bin/jekyll:23:in `<main>'
        40: from /home/---/.rvm/gems/ruby-2.7.3/bin/jekyll:23:in `load'
        39: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
        38: from /home/---/.rvm/gems/ruby-2.7.3/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        37: from /home/---/.rvm/gems/ruby-2.7.3/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        36: from /home/---/.rvm/gems/ruby-2.7.3/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        35: from /home/---/.rvm/gems/ruby-2.7.3/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        34: from /home/---/.rvm/gems/ruby-2.7.3/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        33: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        32: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        31: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
        30: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        29: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
        28: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
        27: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
        26: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/site.rb:82:in `process'
        25: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/site.rb:234:in `write'
        24: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/hooks.rb:102:in `trigger'
        23: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/hooks.rb:102:in `each'
        22: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-4.2.0/lib/jekyll/hooks.rb:103:in `block in trigger'
        21: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-autoprefixer-1.0.2/lib/jekyll-autoprefixer.rb:24:in `block in <top (required)>'
        20: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:20:in `process'
        19: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:20:in `each'
        18: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:23:in `block in process'
        17: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:23:in `open'
        16: from /home/---/.rvm/gems/ruby-2.7.3/gems/jekyll-autoprefixer-1.0.2/lib/jekyll/autoprefixer/autoprefixer.rb:27:in `block (2 levels) in process'
        15: from /home/---/.rvm/gems/ruby-2.7.3/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails.rb:16:in `process'
        14: from /home/---/.rvm/gems/ruby-2.7.3/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails/processor.rb:53:in `process'
        13: from /home/---/.rvm/gems/ruby-2.7.3/gems/autoprefixer-rails-9.8.6.5/lib/autoprefixer-rails/processor.rb:170:in `runtime'
        12: from /home/---/.rvm/gems/ruby-2.7.3/gems/execjs-2.8.0/lib/execjs/runtime.rb:64:in `eval'
        11: from /home/---/.rvm/gems/ruby-2.7.3/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:21:in `eval'
        10: from /home/---/.rvm/gems/ruby-2.7.3/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:39:in `exec'
         9: from Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
         8: from Function.Module._load (node:internal/modules/cjs/loader:829:14)
         7: from Module.load (node:internal/modules/cjs/loader:989:32)
         6: from Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
         5: from Module._compile (node:internal/modules/cjs/loader:1109:14)
         4: from Object.<anonymous> ((execjs):1:58)
         3: from (execjs):1:40
         2: from (execjs):16:14
         1: from (execjs):1:213
eval (eval at <anonymous> ((execjs):1:213), <anonymous>:1:10): TypeError: Cannot read property 'version' of undefined (ExecJS::ProgramError)

@mbiang
Copy link

mbiang commented May 10, 2021

This is occurring for me as well on Ruby 2.7.3. Pinning execjs to 2.7.0 fixes the issue.

@ken-wong
Copy link

ken-wong commented May 11, 2021

I use ruby 3.0.1 on Ubuntu, and execjs 2.8.0 raise errors too.

      01 ExecJS::ProgramError: TypeError: Cannot read property 'version' of undefined
      01 eval (eval at <anonymous> ((execjs):1:213), <anonymous>:1:10)
      01 (execjs):1:213
      01 (execjs):16:14
      01 (execjs):1:40
      01 Object.<anonymous> ((execjs):1:58)
      01 Module._compile (node:internal/modules/cjs/loader:1109:14)
      01 Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
      01 Module.load (node:internal/modules/cjs/loader:989:32)
      01 Function.Module._load (node:internal/modules/cjs/loader:829:14)

@kwent
Copy link

kwent commented May 11, 2021

Same ruby 2.7.3.

@igorkasyanchuk
Copy link

I've the same issue with ruby 3.0

@terryyin
Copy link

Same here for ruby 3.0.1. Rails precompile assets failed.

@SteveW94
Copy link

SteveW94 commented May 11, 2021

Expirience the same error on ruby 3.0.1 with this release.
ExecJS 2.7.0 works fine.

@PedroAugustoRamalhoDuarte

Same error in 2.7.2

@casperisfine
Copy link

The problem is that autoprefixer tries to detect the node version: ai/autoprefixer-rails#203

A long time ago process was removed to ensure all runtimes could be swappable: b0be19c

Let's try to find a solution with autoprefixer, I don't think this version check is the way to go.

@SteveW94
Copy link

Maybe I am missing something here, but couldn't we just use:

exec "node -v"

to determine the current node version on the system?

@casperisfine
Copy link

We could try yes, but the way ExecJS locate the node binary is quite involved. But that would probably work in 99% of the cases.

@SteveW94
Copy link

We could try yes, but the way ExecJS locate the node binary is quite involved. But that would probably work in 99% of the cases.

Yeah I thought the same way...so I thought 99% of the cases maybe would be okay for a non breaking version for now, till a more sophisticated fix is ready.

@casperisfine
Copy link

I'm just not convinced this check is even necessary. It seems to me that it was added to help users figure out why autoprefixer might not work.

I feel like autoprefixer could just not check and add a message to any error that is raised to hint at checking the node version.

@SteveW94
Copy link

Yeah...that should propably point in the right direction too, I think.

bradonomics added a commit to Walls-to-Walls-Cleaning/website that referenced this issue May 11, 2021
@henrik
Copy link

henrik commented May 12, 2021

Not sure if it's the same issue, but we're on Ruby 2.7.3 and our CI got errors building assets:

[****] building asset: /stylesheets/admin/vendor/fontawesome-all.scss
rake aborted!
JSON::ParserError: 439: unexpected token at '{"css":"/*!\n * Font Awesome Pro 5.12.1 by @fontawesome - (truncated a lot of CSS here for GitHub)
/mnt/ramdisk/project/*************/ruby/2.7.0/gems/json-2.5.1/lib/json/common.rb:216:in `parse'
/mnt/ramdisk/project/*************/ruby/2.7.0/gems/json-2.5.1/lib/json/common.rb:216:in `parse'
/mnt/ramdisk/project/*************/ruby/2.7.0/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:68:in `extract_result'
/mnt/ramdisk/project/*************/ruby/2.7.0/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:39:in `exec'
/mnt/ramdisk/project/*************/ruby/2.7.0/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:21:in `eval'
/mnt/ramdisk/project/*************/ruby/2.7.0/gems/execjs-2.8.0/lib/execjs/external_runtime.rb:46:in `call'
/mnt/ramdisk/project/*************/ruby/2.7.0/gems/autoprefixer-rails-8.6.5/lib/autoprefixer-rails/processor.rb:37:in `process'

@SteveW94
Copy link

SteveW94 commented May 12, 2021

An autoprefixer version which fixed the execjs to 2.7.0 for now, got released yesterday.
So if you bundle that again, you should be fine for now,

Also I experience such stuff when updating some asset related gems.
Often deleting all caches and already built assets, and rebuilding everything from scratch helps.
(If it's not the issue mentioned here)

@A1bi
Copy link

A1bi commented May 12, 2021

Not sure if it's the same issue, but we're on Ruby 2.7.3 and our CI got errors building assets:
...

I am experiencing the same with ExecJS 2.8.0 and Ruby 2.7.3. For me it says JSON::ParserError: 434. Had to downgrade to ExecJS 2.7.0 again to fix it.

@mlabarca
Copy link

I've also experienced the JSON parser error with both uglifier and terser but in ruby 2.5.x/rails 5.2.6, downgrading to 2.7.0 fixed it.

@casperisfine
Copy link

Could you open a distinct issue about the uglifier/json problem? I really don't think it's the same thing.

@md5
Copy link

md5 commented May 12, 2021

[Edit: This change I mention wasn't actually the cause; it seems I just got lucky with timing after making this change and didn't see the error since the flush happened in time. See this comment for the real root cause and what was fixed]

I don't see any docs indicating that `IO.popen` takes kwargs in any Ruby version. [This](https://github.com/rails/execjs/commit/c9d2fc6e35b79a6a533c40d358a3291d86fb9f07#diff-8ca2605cfeb0c6a3d7950f2057ad1592708c54e648f131a0d5ef05bd57ebc3fdR200-R212) seems to be the source of the other, possibly unrelated issue noted in this thread.

I've locally modified my clone of execjs to revert the kwags change on the calls to IO.popen and it fixes the JSON::ParserError under MRI Ruby 2.7.3 on macOS and Linux. I did not test under Ruby 3.0. Unfortunately, my employer's Open Source contribution process is pretty onerous, so I'd rather not go through it for such a small change in order to make a PR myself. I'd also rather not receive all the comment traffic if I were to open a new issue myself, so perhaps a maintainer can do that part.

@casperisfine
Copy link

so perhaps a maintainer can do that part.

I'll happily do it if someone gives me enough informations to repro.

@mrgordon
Copy link

This gem needs to be yanked or fixed ASAP. Like many people in this thread, my coworker and I spent several days digging into why our complicated pull request was suddenly failing only to discover that a minor version upgrade of 2.7.0 to 2.8.0 on this library had been causing the arcane error vJSON::ParserError: 419: unexpected token at '{"code":"/*!\n * Flat UI Free v2.2.2 during asset compilation. This is really wasting a lot of time for no reason.

@ernestoe
Copy link

don't know if my issue should be in a different thread, however I have also been able to pinpoint the failure of version 2.8.0 at building a container based solution in the step rails assets:precompile as it gives a JSON::ParserError: 434: unexpected token at ... error

Locking at version 2.7.0 solves the issue.

@byroot
Copy link
Member

byroot commented May 14, 2021

Ok, so:

  • The issue with autoprefixer will be fixed in autoprefixer at some point, in the meantime it's locked to 2.7.0
  • The ParseError is fixed by a6abf13

I'll ask for a release, hopefully it should happen soon. In the meantime as many mentioned you can lock to 2.7.0, or use another runtime, e.g. add the mini_racer gem.

@byroot byroot closed this as completed May 14, 2021
@henrik
Copy link

henrik commented May 14, 2021

@mrgordon Ouch, several days. I realise it won’t work for every project or for every update, but we update deps daily in our main project precisely so it’s easier to pinpoint regressions like this one. In this case we upgraded 3 gems that day, got CI errors from that commit, noted execjs was the only one that seemed related to assets, rolled it back to confirm, then locked the version down. Maybe 40 minutes all in all.

@byroot Thank you! ❤️

@byroot
Copy link
Member

byroot commented May 14, 2021

It's out: https://rubygems.org/gems/execjs/versions/2.8.1

@igorkasyanchuk
Copy link

I still have the same issue:
image

@byroot
Copy link
Member

byroot commented May 14, 2021

@igorkasyanchuk Please read the discussion above. The issue you point is with autoprefixer, and will be fixed in autoprefixer.

@mrgordon
Copy link

@mrgordon Ouch, several days. I realise it won’t work for every project or for every update, but we update deps daily in our main project precisely so it’s easier to pinpoint regressions like this one. In this case we upgraded 3 gems that day, got CI errors from that commit, noted execjs was the only one that seemed related to assets, rolled it back to confirm, then locked the version down. Maybe 40 minutes all in all.

Yes it’s a good idea but with 100 repos it is a taxing exercise to try out every patch and minor version for every single gem. We generally wouldn’t allow major versions to float but a change from 2.7.0 to 2.8.0 is minor and should be backwards compatible. The change log does not indicate anything scary happening either. I guess this major change falls under “improvements for Ruby 3.0”

I was just surprised to see the execjs repo had a failing CI run for the 2.8.0 version and was released anyway. I was also surprised it wasn’t yanked when the problem was discovered to save people like me days of time given that the release clearly didn’t work for many users.

It has been yanked now fortunately but it still wasted about a week of time between my coworker and I, so I hope you’ll be quicker to yank failing code next time.

@casperisfine
Copy link

casperisfine commented May 14, 2021

I was just surprised to see the execjs repo had a failing CI run for the 2.8.0 version and was released anyway.

This was a random CI blurp, nothing concerning.

I was also surprised it wasn’t yanked

This is not what gem yanking is for. It would have created an even bigger mess, especially since only peopke using the node runtime were affected.

It has been yanked now fortunately

No it wasn't.

@md5
Copy link

md5 commented May 14, 2021

@mrgordon you may want to look into the bummr gem to automate some of this: https://github.com/lpender/bummr

@mrgordon
Copy link

This is not what gem yanking is for. It would have created an even bigger mess, especially since only peopke using the node runtime were affected.

You think it would create a bigger mess than people finding a mysterious bug and spending four days looking for it? I somehow doubt it would have taken four days for me to notice that the gem was yanked, maybe 15 seconds. Regardless rolling forward to 2.8.1 was also a fine solution and allows people to use 2.8.0 in the meantime if it works for them (until they run the wrong command and it stops working...). I was trying to provide an immediate solution and it was clear 2.7.0 worked. Its unreasonable to expect bugs to be fixed immediately but if they completely break functionality for many users then at least reverting out the change is usually polite.

It has been yanked now fortunately

No it wasn't.

Okay he rolled forward with a new release, I hadn't seen 2.8.1 yet.

I hope you’ll be quicker to yank failing code next time.

Don't you feel a bit entitled ?

I think after 10+ years we could expect the main Rails project to not leave a majorly broken "minor" upgrade in the current release for like 4 days when people are saying its breaking their projects and is hard to even find the problem. You can consider it entitled, but I consider it a basic aspiration for any well-functioning project. I appreciate all the hard work people put into execjs but I also know that small improvements to process can save people thousands of hours.

@pixeltrix
Copy link
Contributor

@mrgordon yanking a gem has serious side effects - if you analyse the outcome of the mimemagic yanking it left many people unable to deploy their applications and doing the same here was not necessary as there were no legal consequences of leaving it up. The main Rails gem has only been yanked 5 times and 4 of those were RC versions with security flaws. I only became aware of the issue this morning and we pushed the fix out within an hour of it being merged.

I'm sorry you feel you've wasted your time but obviously our intention is that it should've been backwards compatible. One of the reasons we eventually went with 2.8 as the version number is that we would've had to release a new version of Sprockets as well and we didn't want to have to force people to upgrade that at the same time.

Again, I'm sorry for the time you spent having to debug this.

@brissenden
Copy link

Thank you @pixeltrix and everyone else for fixing this in a matter of hours/days. Much appreciated.

@mrgordon
Copy link

@mrgordon yanking a gem has serious side effects - if you analyse the outcome of the mimemagic yanking it left many people unable to deploy their applications and doing the same here was not necessary as there were no legal consequences of leaving it up. The main Rails gem has only been yanked 5 times and 4 of those were RC versions with security flaws. I only became aware of the issue this morning and we pushed the fix out within an hour of it being merged.

I'm sorry you feel you've wasted your time but obviously our intention is that it should've been backwards compatible. One of the reasons we eventually went with 2.8 as the version number is that we would've had to release a new version of Sprockets as well and we didn't want to have to force people to upgrade that at the same time.

Again, I'm sorry for the time you spent having to debug this.

No problem, I understand yanking may not have been the right approach. I appreciate your time certainly and I only commented to let people know the extreme downstream effects in hopes that broken code could be removed as quickly as possible in the future. Certainly if you just learned of the issue then you did everything you could. It just felt like after a few days with the issue being open here it was possible that it wasn’t being reverted while it was looked into as there were a number of comments already including some recommending people upgrade their Ruby version (which didn’t even resolve the issue). People saying the solution was to upgrade the Ruby version made it feel like it wasn’t a “minor” change but in retrospect it seems it was just a bug

@md5
Copy link

md5 commented May 14, 2021

@mrgordon what I think you may be missing is that the fix wasn't even known until @byroot took a look, after which it was fixed and released within hours. The speculation about the fix, including my own, had not identified the actual issue, just the symptoms.

Looking back at the previous commits to node_runner.js, it looks like this call to exit (which was moved to printFinal in a6abf13) may have been the root cause, but @byroot would know better: c5fd11d#diff-114be404cbe934823d902a249c48a759609d7ae02b5e858d0158f4425538c02c

@mrgordon
Copy link

@md5 Yes I assumed a proper fix could take a while to investigate which is why I suggested removing the change ASAP rather than trying to debug it since so many projects use execjs. Obviously a new release rather than yanking was a better solution but even a simple release to just revert the 2.8.0 changes that were related (or all of them) as soon as the issue was reported would have saved several days (or some debugging) for a lot of people.

I guess this repo isn’t changed much anymore so the original maintainers have moved on and there isn’t a big need for day to day maintenance except when a new change breaks something. @byroot actually noticed the issue on his other GitHub account @casperisfine 3 days ago so my point was that a revert release at that point would still have saved about 2 days of brokenness and would have required just a few minutes likely. If he had not had a chance to check in here for a few days (which would be perfectly understandable) then with 43 committers and such an important project it shouldn’t be necessary to wait on one person ideally. It looks like from the contributors tab that he wasn’t even the original author, just someone trying to improve things and keep it up to date. As I’ve hopefully made clear, I’m not trying to give anyone a hard time but it would be good to prevent these kinds of issues in the future. Similar to how no one wants to yank a gem after MimeMagic ;)

@joeyk16
Copy link

joeyk16 commented Dec 8, 2021

I had rails 5.2 with ruby 2.3.1. To fix this issue I had to downgrade to execjs to 2.7.0. Do the following:

  1. Add gem 'execjs', '2.7.0' to your gemfile.
  2. Run bundle update execjs

Then bingo it all worked for me.

@pscdodd
Copy link

pscdodd commented Dec 13, 2021

Just for people looking for this using search engines:
ActionView::Template::Error (TypeError: Cannot read property 'version' of undefined)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests