简体   繁体   中英

Getting error while running "ng serve" for my first angular application

Message&trace:

Generating browser application bundles (phase: building)...(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: 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)...

The latest version of the Angular CLI (12.0.1) does not support Node below version 12.20.

Solution

Update your version of Node to the latest stable version

  • You should pick the version marked LTS, which at the time of writing is in the 14.xx range.

Workaround

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

Add node-sass to your project devDependencies until you are able to update your version of node.

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

You should be careful with this workaround, as node-sass is going to be deprecated soon.

Please try this:

ng update @angular/cli

npm install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM