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

TypeError: Can't add property _eventsCount, object is not extensible #21

Closed
ramukima opened this issue Aug 13, 2016 · 5 comments
Closed
Labels

Comments

@ramukima
Copy link
Contributor

ramukima commented Aug 13, 2016

I was trying to run yang-cord project and saw this error when starting the server -

events.js:221
target._eventsCount = 0;
^
TypeError: Can't add property _eventsCount, object is not extensible
at _addListener (events.js:221:25)
at Model.addListener (events.js:270:10)
at EventEmitter. (*....../yang-cord/lib/api/server.js:14:17)

I patched it like below to make it work locally -
https://github.com/corenova/yang-js/blob/master/src/yang.coffee#L29

      '_events':   writable: true
      '_eventsCount':   writable: true
@sekur
Copy link
Collaborator

sekur commented Aug 13, 2016

Thanks @ramukima your change looks great. Can you create a PR? I think I'm on a much older version of node.js which did not require this property. I recently introduced Object.preventExtensions to the Model so it may potentially break other emitter behavior if there are other private properties that it dynamically creates based on different function calls. Thanks for your help!

@ramukima
Copy link
Contributor Author

ramukima commented Aug 13, 2016

I do not have permission to push to a branch on this repository.

bash-4.3$ git push origin events-issue-21
remote: Permission to corenova/yang-js.git denied to ramukima.
fatal: unable to access 'https://github.com/corenova/yang-js.git/': The requested URL returned error: 403
bash-4.3$

@sekur
Copy link
Collaborator

sekur commented Aug 13, 2016

I've sent you an invite with write permissions to this repo. Thanks!

@sekur sekur added the bug label Aug 13, 2016
@ramukima
Copy link
Contributor Author

Got it, pushed and created a PR. Please merge.

@ramukima
Copy link
Contributor Author

Thanks, works.

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

2 participants