x
)- [X ] bug report -> please search issues before submitting
- [ ] feature request
94% asset optimization(node:11160) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: operator (>)
(node:11160) [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.
I can do normal build only build in prod fails with above error.
greatly appreciate help here.
While I have read the Promise Then and Catch - I have followed the pattern in my source code every where but exact issue is missing and I cant really build anymore.
I am getting the same here. Here is the version detail
and TSCONFIG
Same here with @angular/[email protected]
94% asset optimization(node:20368) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: name (f)
I got this error when I included a script file inside the angular-cli.json written in es6. I converted it to es5 by change 'let' back to 'var' and removing arrow functions.
Im getting this error when i run ng build --prod
95% emittingUnhandled rejection Error: ENOENT: no such file or directory, open
'C:\Users\story\pro\ng-app\node_modules\_@[email protected]@@angular\packa
ge.json'
The version is:
@angular/cli: 1.4.2
node: 7.10.0
os: win32 x64
@angular/animations: 4.4.3
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/router: 4.4.3
@angular/cli: 1.4.2
@angular/compiler-cli: 4.4.3
@angular/language-service: 4.4.3
typescript: 2.3.4
@thekhoi you are right. I've got a custom script included in .angular-cli.json
written in es6. Transpiling to es5 fixed the issue with SyntaxError: Unexpected token: name (f) when building with -prod
flag
Yes, one thing is confirmed, this is due to external scripts. I am using bootstrap 4 in my project and it has a dependency on popper.min.js and it is based on es6. I changed my "target": "es2016", in my tsconfig file and it's working now besides a few warnings, still figuring out how to get rid of them.
updating to es2016 was still messing up with some of my other libraries and it was not suitable. so what I did, I installed popper.js separately via npm and used umd version which is compatible with es5, and changed the target to es5 again in tsconfig and it solved my problem.
Same here. I also use Bootstrap 4 and Pooper.js.
@angular/cli: 1.4.3
node: 7.5.0
os: win32 x64
@angular/animations: 4.3.2
@angular/common: 4.3.2
@angular/compiler: 4.3.2
@angular/compiler-cli: 4.3.2
@angular/core: 4.3.2
@angular/forms: 4.3.2
@angular/http: 4.3.2
@angular/platform-browser: 4.3.2
@angular/platform-browser-dynamic: 4.3.2
@angular/platform-server: 4.3.2
@angular/router: 4.3.2
@angular/cli: 1.4.3
typescript: 2.3.4
.angular-cli.json
...
"scripts": [
"../node_modules/popper.js/dist/umd/popper.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js",
],
...
@thekhoi
I got this error when I included a script file inside the angular-cli.json written in es6. I converted it to es5 by change 'let' back to 'var' and removing arrow functions.
Thanks, it restore production build for me
@chetanvaja did you resolve this issue sir ? can you close this if you finished ?
Hello,
It is still not work with version 1.4.9, any workaround?
Thanks
Same here with @angular/[email protected]
94% asset optimization(node:235548) UnhandledPromiseRejectionWarning: Unhandled
promise rejection (rejection id: 1): SyntaxError: Unexpected token: name (Doubl
eQtyHinge)
How do we fix this? Anyone please respond I am in haste.
Same here -> working with Bootstrap 4 and Popper.js
Facing the same issue in @angular/[email protected] when trying to user Bootstrap with Popper.js in my Angular app.
@sunny061 Use the solution i mentioned
@umarkashmiri I've temporarily solved the problem by downgrading the angular cli to 1.3.2 as mentioned in this answer. https://stackoverflow.com/a/46330054/1874266
This type of error occurs when you try to use ES2015 vendor code with a ES5 app. It was addressed when we added ES2105 support in https://github.com/angular/angular-cli/pull/7610.
I found a solution: https://stackoverflow.com/a/47654981/1820522
@PendelinP this is what I mentioned above.
https://github.com/angular/angular-cli/issues/7725#issuecomment-330939271
I have the same issue. I'm not using Bootstrap nor popper.js. As this issue post has been closed, I suppose this has been fixed. But where and how? My "target" is "es5" while my "lib" is "es2017". Could this be the issue? Changing es5 to es2017 yields the same result. Any help or fix?
I have similar issue when running ./ng build --prod
for ng version 1.5.2
94% asset optimization(node:26226) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: name (Commented)
I've tracked the problem to the include of a particular script via the .angular-cli.json
, I have this :
"scripts": [
"../libs/autobahn-js-built-17.5.2/autobahn.js"
],
... and further, I suspect the error happens during the minification stage (when uglifyjs would be invoked).
I can't seem to find any way to get further logging / diagnostics from ng
, (I tried --verbose
but just gives mainly timing stats, rather information on what sub programs are being invoked etc ... perhap ng
needs option for more detailed output?) ... will continue digging, suspicion is incompatibility between uglifyjs and the external javascript.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
I got this error when I included a script file inside the angular-cli.json written in es6. I converted it to es5 by change 'let' back to 'var' and removing arrow functions.