events.js:288 throw er; // Unhandled 'error' event - node.js

I got the error while doing build in Angular 9.1.0 version.
npm run build
I got bellow error,
throw er; // Unhandled 'error' event
^
Error: write UNKNOWN
at ChildProcess.target._send (internal/child_process.js:806:20)
at ChildProcess.target.send (internal/child_process.js:677:19)
at ChildProcessWorker.send (D:\PublishSource\sample\node_modules\terser-webpack-plugin\node_modules\jest-worker\build\workers\ChildProcessWorker.js:330:17)
at WorkerPool.send (D:\PublishSource\sample\node_modules\terser-webpack-plugin\node_modules\jest-worker\build\WorkerPool.js:32:34)
at Farm._process (D:\PublishSource\sample\node_modules\terser-webpack-plugin\node_modules\jest-worker\build\Farm.js:129:10)
at Farm._enqueue (D:\PublishSource\sample\node_modules\terser-webpack-plugin\node_modules\jest-worker\build\Farm.js:152:10)
at Farm._push (D:\PublishSource\sample\node_modules\terser-webpack-plugin\node_modules\jest-worker\build\Farm.js:159:12)
at D:\PublishSource\sample\node_modules\terser-webpack-plugin\node_modules\jest-worker\build\Farm.js:90:14
at new Promise (<anonymous>)
at Farm.doWork (D:\PublishSource\sample\node_modules\terser-webpack-plugin\node_modules\jest-worker\build\Farm.js:56:12)
at JestWorker._callFunctionWithArgs (D:\PublishSource\sample\node_modules\terser-webpack-plugin\node_modules\jest-worker\build\index.js:178:23)
at TaskRunner.runTask (D:\PublishSource\sample\node_modules\terser-webpack-plugin\dist\TaskRunner.js:41:26)
at enqueue (D:\PublishSource\sample\node_modules\terser-webpack-plugin\dist\TaskRunner.js:80:35)
at D:\PublishSource\sample\node_modules\terser-webpack-plugin\dist\TaskRunner.js:104:86
Emitted 'error' event on ChildProcess instance at:
at internal/child_process.js:810:39
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
errno: 'UNKNOWN',
code: 'UNKNOWN',
syscall: 'write'

Had the same error, tried again without changes and it worked...

Related

promise reject crash try catch everywhere

I put try catch everywhere in my code, but this error still crashes the app. What is the problem:
node:events:515
throw er; // Unhandled 'error' event
^
AbortError: The operation was aborted
at Fetch.onAborted (node:internal/deps/undici/undici:6241:53)
at Fetch.emit (node:events:537:28)
at Fetch.abort (node:internal/deps/undici/undici:5511:14)
at requestObject.signal.addEventListener.once (node:internal/deps/undici/und
ici:5542:22)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:645:20)
at AbortSignal.dispatchEvent (node:internal/event_target:587:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:322:5)
at AbortSignal.abort (node:internal/deps/undici/undici:4974:36)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:645:20)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:645:20)
at AbortSignal.dispatchEvent (node:internal/event_target:587:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:322:5)
at abort (/home/eguneys/chess/rhx/lib/stream.js:17:24)
at PlayOnTurn.fAbort (/home/eguneys/chess/openex/lib/play.js:59:21)
at PlayOnTurn.respondGameAbort (/home/eguneys/chess/openex/lib/play.js:27:68
)
Emitted 'error' event on Readable instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:2
1) {
code: 'ABORT_ERR'
}

I have just started to use nats with my NestJs Microservices, after npm i nats and recompiling my app I receive this error "stream.on"

This is the error in my cmd window after trying to run a npm start
C:\Users\Desktop\app\ms-users\node_modules\#nestjs\microservices\server\server-nats.js:85
stream.on(constants_1.ERROR_EVENT, (err) => this.logger.error(err));
^
TypeError: stream.on is not a function
at ServerNats.handleError (C:\Users\Desktop\app\ms-users\node_modules\#nestjs\microservices\server\server-nats.js:85:16)
at ServerNats.listen (C:\Users\Desktop\app\ms-users\node_modules\#nestjs\microservices\server\server-nats.js:22:14)
at C:\Users\Desktop\app\ms-users\node_modules\#nestjs\microservices\nest-microservice.js:86:51
at new Promise (<anonymous>)
at NestMicroservice.listenAsync (C:\Users\Deskto\app\ms-users\node_modules\#nestjs\microservices\nest-microservice.js:86:16)
at processTicksAndRejections (node:internal/process/task_queues:93:5)

Why am I getting "unexpected end of file" with zlib.js?

I'm using the unzipper Node.js package and it was working fine, processing through my files, when suddenly for seemingly no reason, I got this error:
events.js:291
throw er; // Unhandled 'error' event
^
Error: unexpected end of file
at Zlib.zlibOnError [as onerror] (zlib.js:180:17)
Emitted 'error' event on Parse instance at:
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -5,
code: 'Z_BUF_ERROR'
}
The error gets thrown every time this particular file is processed, others seem to work fine, but I can't think of what's different about this one.
Is this potentially a user-mistake, or a bug I should report?
code:
console.log("unzipping", zipPath) // <-- error triggers after this log
fs.createReadStream(zipPath)
.pipe(unzipper.Parse())
.on('entry', function(entry) {
entry.pipe(fs.createWriteStream(csvPath)).on('finish', () => {
console.log("done unzipping", zipPath)
fd = fs.openSync(csvPath, "r+")
initializeFile()
})
})
}

nodejs child_process.spawn return throw er; // Unhandled 'error' event

I wanna exec another .js file with child_process.spawn. I'm using OSX.
The code is :
var server = spawn( '/Path/to/node', /.../server.js' );
And it is failed with :
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn /Users/GB/Dev/workspace_fe/www_ms/output/node/server.js ENOENT
at exports._errnoException (util.js:870:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
at node.js:968:3
It's working well if only with command in shell /Path/to/node', /.../server.js.
According to docs second argument of spawn must be array. Have you tried this:
var server = spawn( 'node', ['/path/to/server.js'] );

EACCES Error with Gulp-Imagemin

I'm trying to make a gulp task work but I'm getting this error:
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn EACCES
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
It didn't say much about the error itself, so I installed "superstack" and got this:
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn EACCES
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
at DuplexWrapper.Readable.on (/var/www/public/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/stream-combiner2/node_modules/duplexer2/node_modules/readable-stream/lib/_stream_readable.js:703:33)
at Imagemin.run (/var/www/public/node_modules/gulp-imagemin/node_modules/imagemin/index.js:80:9)
at DestroyableTransform.through.obj.percent (/var/www/public/node_modules/gulp-imagemin/index.js:56:12)
at DestroyableTransform._transform (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/through2-concurrent.js:29:15)
at DestroyableTransform.Transform._read (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:10)
at DestroyableTransform.Transform._write (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:160:12)
at doWrite (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:326:12)
at writeOrBuffer (/var/www/public/node_modules/gulp-imagemin/node_modules/through2-concurrent/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:312:5)
Any idea why I'm getting this error? What can I do to fix it?
Thanks a lot!
EDIT:
This is the task I'm trying to run.
gulp.task('build-images', function(){
return gulp.src('app/assets/src/**/*.+(png|jpg|gif|jpeg)')
.pipe($.debug({title:'BEFORE'}))
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe($.debug({title:'AFTER'}))
.pipe(gulp.dest('dest/images'));
});
That is a permissions error. Make sure you have read and write access to all of those files and directories.

Resources