saymedia / angularjs-server

Specialized server for AngularJS sites
MIT License
247 stars 49 forks source link

Cannot set property length of [object Object] which has only a getter #22

Open l0ne opened 9 years ago

l0ne commented 9 years ago

I ran your demo AngularJS-Server Weather Demo and when I tried to open the browser has received such an error: ~/projects/angularjs-server/examples/weather$ node server.js Listening on port 3000 /home/l0ne/projects/angularjs-server/node_modules/angularcontext/node_modules/jsdom/lib/jsdom/level1/core.js:662 Array.prototype.splice.call(this._childNodes, oldChildIndex, 1); ^ TypeError: Cannot set property length of [object Object] which has only a getter at core.Node.removeChild (/home/l0ne/projects/angularjs-server/node_modules/angularcontext/node_modules/jsdom/lib/jsdom/level1/core.js:662:28) at null. (/home/l0ne/projects/angularjs-server/node_modules/angularcontext/node_modules/jsdom/lib/jsdom/level2/events.js:370:17) at proto.(anonymous function) as removeChild at null.innerHTML (/home/l0ne/projects/angularjs-server/node_modules/angularcontext/node_modules/jsdom/lib/jsdom/browser/index.js:465:12) at createFrom.close (/home/l0ne/projects/angularjs-server/node_modules/angularcontext/node_modules/jsdom/lib/jsdom/browser/index.js:160:40) at Object.dispose (/home/l0ne/projects/angularjs-server/node_modules/angularcontext/lib/main.js:233:20) at /home/l0ne/projects/angularjs-server/lib/main.js:28:29 at runSources (/home/l0ne/projects/angularjs-server/node_modules/angularcontext/lib/main.js:55:21) at /home/l0ne/projects/angularjs-server/node_modules/angularcontext/lib/main.js:76:21 at fs.js:334:14

~ node -v v0.12.4

l0ne commented 9 years ago

I found this fix for jsdom https://github.com/dorny/jsdom-little/issues/1 It's working.

apparentlymart commented 9 years ago

@l0ne thanks for digging in to this. Sorry I didn't get back to you sooner.

It looks like that jsdom fix has only gone into the jsdom 5.x.x line, but the 3.x.x line is the last one that supports NodeJS. Did you get it working by altering jsdom locally, or is there a fork of jsdom on npm that you used?

(jsdom is actually a dependency we inherit from node-angularcontext, so the bug is arguably over there, but I also maintain that library so no big deal.)

It's been a concern of mine that we can't adopt new versions of jsdom without breaking Node compatibility, but so far that concern had been theoretical. Our instance of angularjs-server is still running on an 0.10.x release of Node so we've not run into this problem yet, but when I get some spare time I'll try to see whether there's a reasonable solution here.

justinmorant commented 8 years ago

@l0ne did this ever get fixed for node >= 0.12, the weather example is not work for me and I am getting the same error. I have a project with node 4.2 and Angular 1.4 and would like to see if this module can be used.

aaqib90 commented 8 years ago

I am getting the same error. I have a project with node 4.4.1 and Angular 1.2.8 and would like to see if this module can be used.

rjmackay commented 8 years ago

This is still broken. I've tried updating angularcontext to fix it, however while angularcontext is using a later jsdom it has other issues. Looking at fixes for those too.. https://github.com/rjmackay/angularjs-server/tree/update-angular-context https://github.com/rjmackay/node-angularcontext/tree/fix-run-context

apparentlymart commented 8 years ago

Hi all,

Sorry for the silence here.

We tried to get this fixed up a few weeks ago but ran into issues since angularcontext (the library this is built on) is depending on some features of jsdom that are no longer available once it's upgraded. It's likely that this module needs to be redesigned a bunch before it can work on Node 4. We'd like to undertake this eventually, but haven't been able to prioritize it yet.