-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Comments
We are also experiencing the same issue, rolling back 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) |
I am having the same issue. Rolling back to 1.8.0 for now. |
Noticed this causing sporadic failures on reactjs/react-rails also, locking to 1.8.0 for now |
Can someone track down what the appropriate fix / PR for this should be? |
I think coffeescript/src/coffee-script.coffee Line 147 in 88ad059
Btw, this is soon going to be experienced by a lot of people. Not sure what a good fix is. |
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? |
@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:
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 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 If you have an example project where this error occurs, I'd be happy to look into it. |
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:
This JS is being run from Ruby, but I'm pretty sure it uses Node when it's available |
@rmosolgo I downloaded that commit onto my own machine, I ensured I was using coffee-script-source 1.9.0, and ran 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: 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. |
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. |
I don't maintain coffee-script-source. You'll have to ask @sstephenson to help you out. |
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.) |
Same error, going back to 1.8.0 fixed it for me:
|
It might depend on node version. Using CoffeeScript 1.9.1 with node v0.10.12 (or 29), I can reproduce the problem. |
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 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. |
Pinging @josh ... who might be able to rebuild the gem. |
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 |
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 |
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:
then I get error mentioned at the top of the thread above:
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
Is it a known issue that .coffee don't build under some combination of the gems above? |
Two cents, as I also just got this error.
|
We are experiencig the same problem with Rails + CoffeeScript 1.9 (downgrading to 1.8 is fixing the problem).
|
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.
|
…t' of null" when first access see: jashkenas/coffeescript#3829
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:
I statically changed therubyracer to 0.12.0 in my Gemfile and bundle install - now I no longer get this issue. |
I had this issue and realised that spring had been running while I upgraded rails to 4.2 from 4.1.8; I ran |
I was using |
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.
Same problem here. Rolback to gem 'coffee-script-source 1.8.0' works fine. |
Same problem. Works fine with The problem seems to come from a line looking like: Here's the difference in the compiled output between the two versions:
Not sure if that helps. |
👍 same here. |
same here |
same |
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. |
I was having the same issue. Fixed by upgrading nodejs and now everything works great. Was running
Updated to stable
Part of my Gemfile.lock
|
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). |
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! 👍 |
It looks like this may have been resolved in |
@CyborgMaster Can confirm that 1.10.0 is working with my project. Thanks a million! |
I can also confirm. Working with latest.
|
Thank you. |
thanks for the update. |
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.The text was updated successfully, but these errors were encountered: