Skip to content

Cannot set property 'root' of null #3829

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

Closed
asafbrukarz opened this issue Feb 5, 2015 · 39 comments
Closed

Cannot set property 'root' of null #3829

asafbrukarz opened this issue Feb 5, 2015 · 39 comments
Labels

Comments

@asafbrukarz
Copy link

My apologies if this is the wrong place to put this, but I can't find the git repo for coffee-script-source.

We have a Rails 4.1.9 app and a strange error has started to occur after upgrading our dependencies.

With the latest version of gem 'coffee-script-source', '=1.9.0' we receive the following error when trying to precompile our assets.

We have confirmed that rolling back to v1.7.1 fixes the issue.

I believe that this was caused by #3498.

We have looked at the offending file tags.js.coffee and could find no obvious errors. When we remove that file, the same error occurs on another file.

> rm -rf public/assets/ && rm -rf tmp/cache/
> RAILS_GROUP=assets RAILS_ENV=production bundle exec rake assets:precompile
...
...
...
rake aborted!
ExecJS::ProgramError: TypeError: Cannot set property 'root' of null
  (in /Users/a/Development/pc/app/assets/javascripts/widgets/tags.js.coffee)
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:58:in `rescue in block in call'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:52:in `block in call'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:87:in `block in lock'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:85:in `call'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:85:in `Locker'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:85:in `lock'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:51:in `call'
/Users/a/.rvm/gems/ruby-2.1.4/gems/coffee-script-2.3.0/lib/coffee_script.rb:76:in `compile'
/Users/a/.rvm/gems/ruby-2.1.4/gems/tilt-1.4.1/lib/tilt/coffee.rb:46:in `evaluate'
/Users/a/.rvm/gems/ruby-2.1.4/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:12:in `initialize'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `each'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `each'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:16:in `initialize'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:211:in `block in find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:257:in `benchmark'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:210:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:119:in `block in compile'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `each'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `compile'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/rake/sprocketstask.rb:146:in `with_logger'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
/Users/a/.rvm/gems/ruby-2.1.4/bin/ruby_noexec_wrapper:14:in `eval'
/Users/a/.rvm/gems/ruby-2.1.4/bin/ruby_noexec_wrapper:14:in `<main>'
V8::Error: Cannot set property 'root' of null
at e (<eval>:10:2965)
at e.Code.t.makeScope (<eval>:11:3727)
at e.Code.t.compileNode (<eval>:11:4190)
at e.Base.e.compileToFragments (<eval>:10:6441)
at e.Assign.n.compileNode (<eval>:10:32155)
at e.Base.e.compileToFragments (<eval>:10:6441)
at e.Obj.t.compileNode (<eval>:10:26117)
at e.Base.e.compileToFragments (<eval>:10:6441)
at e.Value.t.compileNode (<eval>:10:17090)
at e.Base.e.compileToFragments (<eval>:10:6441)
at e.Assign.n.compileNode (<eval>:10:32155)
at e.Base.e.compileToFragments (<eval>:10:6441)
at e.Block.t.compileNode (<eval>:10:10361)
at e.Block.t.compileWithDeclarations (<eval>:10:11811)
at e.Block.t.compileRoot (<eval>:10:11313)
at e.Block.t.compileToFragments (<eval>:10:10098)
at <eval>:11:30692
at <eval>:11:30332
at <eval>:3:33
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:53:in `block in call'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:87:in `block in lock'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:85:in `call'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:85:in `Locker'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:85:in `lock'
/Users/a/.rvm/gems/ruby-2.1.4/gems/execjs-2.3.0/lib/execjs/ruby_racer_runtime.rb:51:in `call'
/Users/a/.rvm/gems/ruby-2.1.4/gems/coffee-script-2.3.0/lib/coffee_script.rb:76:in `compile'
/Users/a/.rvm/gems/ruby-2.1.4/gems/tilt-1.4.1/lib/tilt/coffee.rb:46:in `evaluate'
/Users/a/.rvm/gems/ruby-2.1.4/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:12:in `initialize'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `each'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `each'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:16:in `initialize'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:211:in `block in find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:257:in `benchmark'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:210:in `find_asset'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:119:in `block in compile'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `each'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `compile'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-2.12.3/lib/rake/sprocketstask.rb:146:in `with_logger'
/Users/a/.rvm/gems/ruby-2.1.4/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
/Users/a/.rvm/gems/ruby-2.1.4/bin/ruby_noexec_wrapper:14:in `eval'
/Users/a/.rvm/gems/ruby-2.1.4/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
@chrisbarber86
Copy link

We are also experiencing the same issue, rolling back coffee-script-source to 1.8.0 seems to fix the problem. Unfortunately running our tests on a local machine seems to work fine, but fails consistently on our CI server for this issue.

Running task rake spec:javascripts, RAILS_ENV=test
rake aborted!
Capybara::Poltergeist::JavascriptError: One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).

Error: ExecJS::ProgramError: TypeError: Cannot set property 'root' of null
  (in /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/gem_name-1.15.1/vendor/assets/javascripts/foo.coffee)
Error: ExecJS::ProgramError: TypeError: Cannot set property 'root' of null
  (in /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/gem_name-1.15.1/vendor/assets/javascripts/foo.coffee)
    at http://127.0.0.1:51887/assets/application.js:1
Tasks: TOP => spec:javascripts
(See full trace by running task with --trace)

@CyborgMaster
Copy link

I am having the same issue. Rolling back to 1.8.0 for now.

@rmosolgo
Copy link

rmosolgo commented Feb 6, 2015

Noticed this causing sporadic failures on reactjs/react-rails also, locking to 1.8.0 for now

@jashkenas
Copy link
Owner

Can someone track down what the appropriate fix / PR for this should be?

@vipulnsward
Copy link

I think

sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox
is causing this issue, which looks like is getting raised due to #3498

Btw, this is soon going to be experienced by a lot of people. Not sure what a good fix is.

@mbrio
Copy link
Contributor

mbrio commented Feb 12, 2015

I worked on the PR that may have caused the issue, could anyone having the issue tell me what versions of node they are running?

@mbrio
Copy link
Contributor

mbrio commented Feb 12, 2015

@vipulnsward Is there a specific reason why you believe line 147 is causing the issue? I did a test in a blank coffee file with just the following:

sandbox = null
sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox

And the error when run through coffee, or compiled and run through node comes back as Cannot set property 'GLOBAL' of null which makes sense since GLOBAL would be set before root.

I did a search throughout the exported JS code from the coffee script library and there are a number of locations, both in the output and the libraries coffee script uses where root is set on an object.

If you have an example project where this error occurs, I'd be happy to look into it.

@rmosolgo
Copy link

Here's a travis-ci build that demonstrates this issue:

https://travis-ci.org/reactjs/react-rails/jobs/50499450

Sorry, I'm not sure exactly what config information is helpful for you, but here's some that jumped out:

Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
# ...
PhantomJS version
1.9.8

This JS is being run from Ruby, but I'm pretty sure it uses Node when it's available

@mbrio
Copy link
Contributor

mbrio commented Feb 12, 2015

@rmosolgo I downloaded that commit onto my own machine, I ensured I was using coffee-script-source 1.9.0, and ran BUNDLE_GEMFILE=gemfiles/rails_4.0_with_therubyracer.gemfile bundle exec rake test which is the only version of rake test that was failing, when using other BUNDLE_GEMFILEs it worked fine.

I saw the error Cannot set property 'root' of null occur. I went into the coffee-script-source gem and changed the part of the JS file where it says: l.global=l.root=l.GLOBAL=l to l.global=l.fake=l.GLOBAL=l. I re-ran the test and got the same exact error stating that root could not be set. What this means is the area of the code specified in coffee-script is not causing the error, the error is occurring somewhere else in either turbolinks or somewhere else in coffee-script.

If I have some time later today/tomorrow I'll try and hunt down where in the code the issue is occurring.

@jashkenas just to keep you in the loop, the error that is occurring is not associated with my commit, but I will try and solve it later today/tomorrow.

@mbrio
Copy link
Contributor

mbrio commented Feb 12, 2015

So, I believe I figured out the problem. I did some tests manually updating the coffee-script-source gem's coffee-script.js file. What I noticed is the supplied browser supported JS file for coffee-script didn't match the compiled output of the 1.9.0 coffee files. When I recompiled the JS files and replaced the ones supplied in coffee-script-source the error no longer occurred.

So I put in a PR with @jashkenas, hopefully this will get merged in ASAP and coffee-script-source will need to update to the latest compiled browser file.

@jashkenas
Copy link
Owner

I don't maintain coffee-script-source. You'll have to ask @sstephenson to help you out.

@johnmaxwell
Copy link

I'm still experiencing this error using coffee-script-source 1.9.1 and Rails 4.2.1.rc1. I'm using therubyracer 0.12.1 to compile CS and coffee-rails 4.1.0. FWIW, I'm not using Turbolinks. (Turbolinks was mentioned above.)

@allaire
Copy link

allaire commented Feb 23, 2015

Same error, going back to 1.8.0 fixed it for me:

# TODO: https://github.com/jashkenas/coffeescript/issues/3829
gem "coffee-script-source", "~> 1.8.0"

@koron
Copy link

koron commented Feb 24, 2015

It might depend on node version.

Using CoffeeScript 1.9.1 with node v0.10.12 (or 29), I can reproduce the problem.
But with node v0.12, I can't.

@mbrio
Copy link
Contributor

mbrio commented Feb 24, 2015

Just putting this out there for reference of what I did for testing (since my pull was referenced as being a possible culprit of the problem). When I ran the tests within react-rails I had gotten the problem, you can see I stated this in one of my comments above. I was able to reproduce the error in all versions of node (0.8.28, 0.10.36, and 0.11.14 at the time).

To stop the error from happening I had downloaded the master repo of coffee-script, compiled a new coffee-script JS file, and replaced the distributed JS file within coffee-script-source. This fixed the problem for me.

When I looked throughout the JS library I had found that there were references to root being set on an object that didn't exist in the CS source code, this makes me think that when CS is compiled into a JS library it's injecting code to ensure it works in many different environments (maybe they are polyfills, I didn't have enough time to research it). In any case, when I compiled the source code from scratch I didn't receive the error anymore.

It's interesting to hear that node 0.12 stopped the error from occurring, when looking into the problem I had wondered if the error was actually a node error and not CS at all.

@jashkenas
Copy link
Owner

Pinging @josh ... who might be able to rebuild the gem.

@alepee
Copy link

alepee commented Feb 25, 2015

This error happened as well within coffee-rails wrapper using therubyracer 0.12.1 as JS runtime

EDIT: I switched to coffee-script 1.8.0 and this did not occurred again so far

@josh
Copy link
Contributor

josh commented Feb 25, 2015

I can't seem to reproduce any of the combinations here.

gem 'execjs', '2.3.0'
gem 'coffee-script', '2.3.0'
gem 'coffee-script-source', '1.9.1'
gem 'therubyracer', '0.12.1' # with or without
$ node -v
v0.12.0

You're welcome to open any issues like this on https://github.com/josh/ruby-coffee-script/issues or move this one over there if you'd like.

I can also make sure Script and vm are marked as undefined in ExecJS when running under node to normalize the environment if that would help.

@johnmaxwell
Copy link

Okay, I've got some more info. In my case, the issue seems to be tied to using therubyracer. If I precompile the Rails assets with therubyracer like so:

RAILS_ENV=staging EXECJS_RUNTIME=RubyRacer rake assets:precompile

then I get error mentioned at the top of the thread above: V8::Error: Cannot set property 'root' of null. However, if I tell it to use the latest Node (0.12.0) when precompiling, then it works fine:

RAILS_ENV=staging EXECJS_RUNTIME=Node rake assets:precompile

N.B. I am clobbering the assets between precompiles, so that it happens from scratch every time.

I'm using the latest JS/CS gems, and testing under Rails 4.2.1.rc2

$ bundle show | grep 'coffee-script-source\|execjs\|therubyracer\|libv8'
  * coffee-script-source (1.9.1)
  * execjs (2.3.0)
  * libv8 (3.16.14.7)
  * therubyracer (0.12.1)

Is it a known issue that .coffee don't build under some combination of the gems above?

@Overload119
Copy link

Two cents, as I also just got this error.

Using coffee-script-source 1.8.0 (was 1.9.1)
Using execjs 2.3.0
Using coffee-script 2.3.0
Using coffee-rails 3.2.2
Using react-source 0.12.2
Using react-rails 0.12.2.0

@ZipoKing
Copy link

ZipoKing commented Mar 1, 2015

We are experiencig the same problem with Rails + CoffeeScript 1.9 (downgrading to 1.8 is fixing the problem).
I've found following rules re this issue:

  • it happens only with CoffeeScript >= 1.9
  • it happens only once when "buggy file" will be updated and corresponding cache file in tmp/cache must be updated (or tmp/cache is empty). It happens only once and when page will be refreshed, everything works correctly.
  • we are using therubyracer gem - when I'll disable it and start using Node.JS, everything works fine. May it be related to CoffeeScript+V8 (JS engine from Chrome used by therubyrracer gem) conflict?

@koron
Copy link

koron commented Mar 3, 2015

I have uploaded a reproducible script to gist: unstable.js

This script can be ran successfully with node v0.12, but failed with v0.10.33.

This is intermediate file which generated by rails3.2 + execJS 2.3 + coffeescript 1.9.1 + nodejs 0.10.33. It includes minified coffescript compiler and my coffeescript source. It will compile my coffeescript source, and output JavaScript source if it was succeeded.

You'll get this like output when it failed.

$ node unstable.js
["err","TypeError: Cannot set property 'root' of null"]

hyone added a commit to hyone/clatter that referenced this issue Mar 4, 2015
@tgmerritt
Copy link

I just experienced this issue as well -

I found that therubyracer 0.12.1 was the problem for me.

Here was parts of my Gemfile.lock before:

coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-rails-source-maps (1.4.0)
      coffee-script-source (>= 1.6.1)
    coffee-script (2.3.0)
      coffee-script-source
      execjs
    coffee-script-source (1.9.1)
...
therubyracer (0.12.1)
      libv8 (~> 3.16.14.0)
      ref

I statically changed therubyracer to 0.12.0 in my Gemfile and bundle install - now I no longer get this issue.

@tyronewilson
Copy link

I had this issue and realised that spring had been running while I upgraded rails to 4.2 from 4.1.8; I ran spring stop then started the server with rails s and the issue was gone.

@CyborgMaster
Copy link

I was using therubyracer 0.12.1. I tried reverting to 0.12.0 like @tgmerritt said, but it didn't fix it for me. Still stuck on version 1.8 here.

christopherstyles added a commit to christopherstyles/react-rails that referenced this issue Mar 20, 2015
There is an issue with the latest version of `coffee-script-source`
outlined in the following issue:

    jashkenas/coffeescript#3829

When the `react-rails` gemspec specifies a `~>1.9` version it makes it
impossible to back out of the most recent `coffee-script-source` update
to avoid the errors. This change lowers the dependency version in the
`react-rails` gemspec so that a user can specify a lower version.
@spuyet
Copy link

spuyet commented Mar 25, 2015

Same problem here. Rolback to gem 'coffee-script-source 1.8.0' works fine.

@ouranos
Copy link

ouranos commented Mar 26, 2015

Same problem. Works fine with coffee-script-source 1.8.0

The problem seems to come from a line looking like: item not in array as I don't have the error if I comment it.

Here's the difference in the compiled output between the two versions:

1.8 1.9.1
__indexOf = [].indexOf ... indexOf = [].indexOf ...
__indexOf.call(array, item) < 0) indexOf.call(array, item) < 0)

Not sure if that helps.

@zosiu
Copy link

zosiu commented Mar 31, 2015

👍 same here.

@luccasmaso
Copy link

same here

@irobayna
Copy link

irobayna commented Apr 1, 2015

same

@rzane
Copy link

rzane commented Apr 1, 2015

Same here's don't help anybody. If you want to updates on this issue, click the subscribe button in the top left. Every time someone says 'same here', every single person subscribed to this issue gets an email.

@cowholio4
Copy link

I was having the same issue. Fixed by upgrading nodejs and now everything works great.

Was running

node --version
v0.10.29

Updated to stable

node --version
v0.12.2

Part of my Gemfile.lock

therubyracer (0.12.1)
  libv8 (~> 3.16.14.0)
  ref
coffee-rails (4.1.0)
  coffee-script (>= 2.2.0)
  railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
  coffee-script-source
  execjs
coffee-script-source (1.9.1)

@bobatsar
Copy link

I also had the same problem calling coffee-script.js from pyexecjs. Solved it by removing pyv8 and installing node.js v0.12.2 Now pyexecjs uses node.js (also V8 but perhaps a newer version).

@ea0723
Copy link

ea0723 commented Nov 10, 2015

I ran into the same problem today - only when building on Heroku.

Updating execjs did not solve, but setting coffee-script-source to 1.8.0 (rolled back from 1.9.0) in Gemfile.lock solved the issue...

Thanks for the hints above! 👍

@CyborgMaster
Copy link

It looks like this may have been resolved in coffee-script-source version 1.10.0. If others can confirm this, maybe this issue can be closed.

@ZipoKing
Copy link

ZipoKing commented Jan 7, 2016

@CyborgMaster Can confirm that 1.10.0 is working with my project. Thanks a million!

@ghepting
Copy link

ghepting commented Jan 7, 2016

I can also confirm. Working with latest.

@nolith
Copy link

nolith commented Apr 19, 2016

Thank you. ~>1.10.0 fixed this issue for me

@vendethiel
Copy link
Collaborator

thanks for the update.

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

No branches or pull requests