Uncaught TypeError: Cannot redefine property: isOpen
See original GitHub issueCode:
if(self.client && !self.client.isOpen)
self.client.open(onConnect.bind(self));
else{
var client = new ModbusRTU();
if(self.info.tcp)
client.connectTCP(self.info.address, { port: self.info.tcp_port }, onConnect.bind(self));
else
client.connectRTUBuffered(self.info.port, { baudRate: self.info.baud_rate }, onConnect.bind(self));
self.client = client;
}
Uncaught TypeError: Cannot redefine property: isOpen
at Function.defineProperty (<anonymous>)
at ModbusRTU.open (/media/daniel/DATA/MQTT_Gateway_Node/node_modules/modbus-serial/index.js:349:12)
at setClient (/media/daniel/DATA/MQTT_Gateway_Node/modbus-reader.js:84:17)
at Timeout._onTimeout (/media/daniel/DATA/MQTT_Gateway_Node/modbus-reader.js:101:25)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
ModbusRTU.open @ index.js:349
setClient @ modbus-reader.js:84
(anonymous) @ modbus-reader.js:101
ontimeout @ timers.js:386
tryOnTimeout @ timers.js:250
listOnTimeout @ timers.js:214
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
TypeError: can't redefine non-configurable property "x"
The JavaScript exception "can't redefine non-configurable property" occurs when it was attempted to redefine a property, but that property is non-configurable.
Read more >jest spyOn not working on index file, cannot redefine property
The reason for this error message (JavaScript) is explained in this post TypeError: Cannot redefine property: Function.defineProperty ().
Read more >Cannot assign to read only property of Object in JavaScript
The error "Cannot assign to read only property of object" occurs when we try to change a property of an object that has...
Read more >useDisclosure - Chakra UI
Return value#. The useDisclosure hook returns an object with the following fields: Name, Type, Default, Description. isOpen, boolean ...
Read more >x-data - Alpine.js
Notice the "Content" now depends on the isOpen getter instead of the open property directly. In this case there is no tangible benefit....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
v7.1.5 with #185 is published on npm
Thanks @robertsLando 👍
@yaacov I need to bind the callback function to the context of the main class to be able to access the class attributes once the callback function is triggered. I could did this without using
.bind
just by writing the function locally like.connect(function(err){})
but as I use it more times I have choose to create a private function inside the class.In logger example you check the error than you close the port and you recreate one but why to close the port and create a new one when you can just call
.open()
method whit the already existing client? I do the reconnect in this way and it works.