Skip to content
This repository has been archived by the owner on Aug 9, 2018. It is now read-only.

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

Open
l0ne opened this issue Jun 10, 2015 · 6 comments
Open

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

l0ne opened this issue Jun 10, 2015 · 6 comments

Comments

@l0ne
Copy link

l0ne commented Jun 10, 2015

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
Copy link
Author

l0ne commented Jun 11, 2015

I found this fix for jsdom dorny/jsdom-little#1
It's working.

@apparentlymart
Copy link
Collaborator

@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
Copy link

@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
Copy link

aaqib90 commented Mar 24, 2016

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
Copy link

rjmackay commented Jun 5, 2016

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
Copy link
Collaborator

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.

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

No branches or pull requests

5 participants