node:events:371 throw er; // Unhandled 'error' event ^ Error: read EFAULT - node.js

I've been getting this error and have tried reinstalling node/vscode already to no avail. This happens maybe 30% of the time after I save my changes in vscode and it ALWAYS crashes my node server.
Nodemon doesn't turn my server back on and it gets really tedious when trying to code. Does anyone have any solutions to this problem?
I'm running on a Macbook Air 2020 with a M1 chip if that makes a difference.
(Using express / nodejs ) node v16.6.0
I've tried killall node, I've tried changing port number. same errors
throw er; // Unhandled 'error' event
^
Error: read EFAULT
at Pipe.onStreamRead (node:internal/stream_base_commons:211:20)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -14,
code: 'EFAULT',
syscall: 'read'
}```

Related

How can I trace back "EPROTONOSUPPORT: protocol not supported :::3000" in node.js?

I am more than clueless at the moment. I am trying to start a keystonejs-6 app in production mode and the the app throws this error:
Starting Keystone
node:events:505
throw er; // Unhandled 'error' event
^
Error: listen EPROTONOSUPPORT: protocol not supported :::3000
at Server.setupListenHandle [as _listen2] (node:net:1355:21)
at listenInCluster (node:net:1420:12)
at doListen (node:net:1559:7)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1399:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EPROTONOSUPPORT',
errno: -43,
syscall: 'listen',
address: '::',
port: 3000
}
I have no way to trace back, at which point of the keystonejs application code the error originated. As it seems, keystonejs provides practically no logging on the application code itself.
Is there a way to find out, what kind of protocol is meant by this error message?

NODEJS TEDIOUS reconnect

I've connected to an SQL Server using Tedious/NodeJS. Connection and queries are working fine (in command-line) until the connection (LAN or WIFI) goes down.
Then, the nodejs script in cmd throws an unhandled error event .
How I can catch disconnections and reconnect, while keeping the script running in console?
events.js:174<br>
throw er; // Unhandled 'error' event<br>
^<br>
ConnectionError: Connection lost - read ECONNRESET<br>
at ConnectionError (dev node\node_modules\tedious\lib\errors.js:13:12)<br>
at Connection.socketError (dev node\node_modules\tedious\lib\connection.js:1297:54)<br>
at Socket.socket.on.error (dev node\node_modules\tedious\lib\connection.js:1128:14)<br>
at Socket.emit (events.js:203:15)<br>
at emitErrorNT (internal/streams/destroy.js:91:8)<br>
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)<br>
at process._tickCallback (internal/process/next_tick.js:63:19)<br>
Emitted 'error' event at:<br>
at Connection.socketError (dev node\node_modules\tedious\lib\connection.js:1297:12)<br>
at Socket.socket.on.error (dev node\node_modules\tedious\lib\connection.js:1128:14)<br>
[... lines matching original stack trace ...]<br>
at process._tickCallback (internal/process/next_tick.js:63:19)<br>
Win7
node V10.16.0
Microsoft SQL Server Standard Edition (64-bit)

Error while watching folder and file for change

I am tailing a file for change and using fs.watch on a directory for newly added files and I received the following error causing my app to crash after a couple of hours working?
Any ideas what this means or why it would occur?
events.js:288
throw er; // Unhandled 'error' event
^
Error: ECONNRESET: connection reset by peer, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
Emitted 'error' event on FSWatcher instance at:
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:133:12) {
errno: -4077,
syscall: 'watch',
code: 'ECONNRESET',
filename: null

Unhandled 'error' event how to find out which line of code it's happening?

I'm getting this error:
events.js:137
throw er; // Unhandled 'error' event
^
Error: socket hang up
at createHangUpError (_http_client.js:330:15)
at Socket.socketOnEnd (_http_client.js:423:23)
at Socket.emit (events.js:165:20)
at endReadableNT (_stream_readable.js:1101:12)
at process._tickCallback (internal/process/next_tick.js:152:19)
I know it's a socket.on('error') not handled, but the problem is I don't know where this socket is in my code. It doesn't say the line. Also this error only happens every 10min or so so I can't just comment things in and out and retry. Where can I know the exact line this socket is at?

DiscordJS and Linux's Screen

I'm facing an issue with discordjs and i don't understand it. I run "node main.js" into a linux screen, detach it, go to sleep and when i come back, it crashed. Could you enlight me ?
# screen -r BotApex
(node:6559) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
events.js:180
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at Client.emit (events.js:178:17)
at WebSocketConnection.onError (/root/ApexLegendsSnipeBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
at WebSocket.onError (/root/ApexLegendsSnipeBot/node_modules/ws/lib/event-target.js:128:16)
at WebSocket.emit (events.js:189:13)
at _receiver.cleanup (/root/ApexLegendsSnipeBot/node_modules/ws/lib/websocket.js:211:14)
at Receiver.cleanup (/root/ApexLegendsSnipeBot/node_modules/ws/lib/receiver.js:557:13)
at WebSocket.finalize (/root/ApexLegendsSnipeBot/node_modules/ws/lib/websocket.js:206:20)
at TLSSocket.emit (events.js:189:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
Looks like your bot ran into an error event while you were away. If you don't handle error events they usually make your bot crash. To prevent the bot from crashing, simply add an error listener:
client.on("error", info => {
console.log('Error event:\n' + JSON.stringify(info));
// handle the error here
});
Please keep in mind that the error event has been called for some reason and that you should handle the error afterwards.

Resources