Ng build --prod UnhandledPromiseRejectionWarning: Refusing a raw promise

Angular 4.3 When trying to run ng build -prod

the following error occurs:
94% asset optimization(node:7184) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: name (i)

I don’t know where this problem comes from, as this is the only error I can find.

+4
source share
3 answers

Discard angular CLI version 1.3.2 until this error is fixed:

npm install @angular/cli@1.3.2(add -gif you use global package)

Now you can build :).

+3
source

Same: (

In my case, the problem occurs in combination with popper.js, as indicated here: https://github.com/angular/angular-cli/issues/7725

EDIT: : Angular -CLI-Configuration (.angular-cli.json):

"scripts": [
  ...
  "../node_modules/popper.js/dist/popper.min.js",
  ...
],

( /dist/ umd):

"scripts": [
 ...
 "../node_modules/popper.js/dist/umd/popper.min.js",
 ...
],
+1

Angular 5 ng build --prod ng 1.5.2

94% asset optimization(node:26226) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: name (Commented)

script .angular-cli.json, :

"scripts": [
    "../libs/autobahn-js-built-17.5.2/autobahn.js"
],

... , , , ( uglifyjs).

/ ng ( --verbose, , , ..)... , - uglifyjs javascript.

0

Source: https://habr.com/ru/post/1685981/


All Articles