corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

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

Closed ramukima closed 8 years ago

ramukima commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

ramukima commented 8 years ago

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

ramukima commented 8 years ago

Thanks, works.