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: Cannot assign to read only property 'name' of object '[object Object]' on Node 6.3.1 --use-strict (Ubuntu 16.04) #103

Open
santoxyz opened this issue Jul 12, 2018 · 0 comments

Comments

@santoxyz
Copy link

ref is used in my project as a dependency to net-keepalive.

On my develop machine everything is fine... but when i deploy to target machine (same x64 architecture of develop machine, and same node version, but different OS version; i use archilinux on the develop machine) node exits with:

//----
TypeError: Cannot assign to read only property 'name' of object '[object Object]'
at Object.refType (/home/hemosafe2/robot/node_modules/net-keepalive/node_modules/ref/lib/ref.js:309:14)
at Object. (/home/hemosafe2/robot/node_modules/net-keepalive/node_modules/ffi/lib/type.js:22:42)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/home/hemosafe2/robot/node_modules/net-keepalive/node_modules/ffi/lib/cif.js:6:12)
//----

i'm too noob in javascrpt and absolutely not able to understand this error; but searched on Stackoverflow and found this https://stackoverflow.com/questions/44288164/cannot-assign-to-read-only-property-name-of-object-object-object

so i tried this fix, and seems it worked:

in node_modules/net-keepalive/node_modules/ref/lib/ref.js :

exports.refType = function refType (type) {
var _type = exports.coerceType(type)
var rtn = Object.create(_type)
rtn.indirection++
if (_type.name) {
- rtn.name = _type.name + ''
+ Object.defineProperty(rtn, 'name', {
+ writable: true,
+ value: _type.name + '
'
+ });
}
return rtn
}

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

No branches or pull requests

1 participant