Home » UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList at new Worker (internal/worker.js:170:17)

UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList at new Worker (internal/worker.js:170:17)

To solve UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList at new Worker (internal/worker.js:170:17) error follow below methods.

ERROR LOG

(node:5312) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:5312) [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.
(node:5312) UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList
    at new Worker (internal/worker.js:170:17)
    at SassWorkerImplementation.createWorker (C:\Users\shail\iacademiaApp1\node_modules\@angular-devkit\build-angular\src\sass\sass-service.js:96:24)
    at SassWorkerImplementation.render (C:\Users\shail\iacademiaApp1\node_modules\@angular-devkit\build-angular\src\sass\sass-service.js:62:40)
    at Object.loader (C:\Users\shail\iacademiaApp1\node_modules\sass-loader\dist\index.js:46:3)
(node:5312) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
/ Generating browser application bundles (phase: building)...

How to solve UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList at new Worker ?

After some research, I discovered that the most recent version of the Angular CLI (12.0.1) does not support Node versions lower than 12.20.

So, the permanent answer is to update your Node version to the most recent stable version to resolve this problem. You should select the LTS version, which is currently in the 14.x.x range at the time of writing.

Only do this if you are unable to update your Node version for some reason.

Add node-sass to your project’s dependencies until you can update your node version.

npm i -save-dev node-sass
yarn add -D node-sass

Alternative to Solve UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList at new Worker

To solve UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList at new Worker. Try the below commands :

ng update @angular/cli
npm install
ng serve

Hope the above solution works.

Also read :

Building for iOS Simulator but the linked and embedded framework ‘My.framework’ was built for iOS + iOS Simulator
Not using the local TSLint version found error in Visual Studio Code. To enable code execution from the current workspace you must enable workspace library execution