Repository navigation
Closed
Labels
P5The team acknowledges the request but does not plan to address it, it remains open for discussionThe team acknowledges the request but does not plan to address it, it remains open for discussioneffort2: medium (days)freq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity1: confusingtype: faq
Description
Bug Report or Feature Request (mark with an x)
- [X] bug report -> please search issues before submitting
- [] feature request
Versions.
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.0.0
node: 6.9.4
os: darwin x64
@angular/animations: 4.0.0
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/compiler-cli: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/platform-server: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.0.0
Repro steps.
I run...
ng build --prod
But uglify fails and there's no way to investigate it because the dest folder isn't created on this failure. Specifically trying to investigate Unexpected token operator «=», expected punc «,» .
chunk {0} 0.d17559b9dc1f9710df9e.chunk.js 977 kB {1} {2} [rendered]
chunk {1} 1.3fb611ed62385f1481c5.chunk.js 762 kB {0} {2} [rendered]
chunk {2} main.6670c5c330feeaa5af25.bundle.js (main) 760 kB {5} [initial] [rendered]
chunk {3} scripts.bf4293b30b91e67e776a.bundle.js (scripts) 124 kB {6} [initial] [rendered]
chunk {4} styles.5d73c197136fb409042d.bundle.css (styles) 228 bytes {6} [initial] [rendered]
chunk {5} vendor.1f74f5a264bded28ec07.bundle.js (vendor) 3.63 MB [initial] [rendered]
chunk {6} inline.51a70f6c591274413cac.bundle.js (inline) 0 bytes [entry] [rendered]
ERROR in 0.d17559b9dc1f9710df9e.chunk.js from UglifyJs
Unexpected token operator «=», expected punc «,» [0.d17559b9dc1f9710df9e.chunk.js:9262,39]
The log given by the failure.
Desired functionality.
Would like some more context. The intermediate files should not be deleted on an UglifyJs failure because there's not much to go on.
Mention any other details that might be useful.
This error started for me today after I tried to update to angular 4 and the new angular cli.
Reacted by hiepxanh, salem mnassri, Moobie and Alouane Nour-Eddine
Metadata
Metadata
Assignees
Labels
P5The team acknowledges the request but does not plan to address it, it remains open for discussionThe team acknowledges the request but does not plan to address it, it remains open for discussioneffort2: medium (days)freq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity1: confusingtype: faq
Activity
calbot commentedon Mar 30, 2017
I believe this was caused by a module I was importing ('text-mask-core') which used default parameters in the source. I was importing directly from the module's src folder instead of the dist which is compatible. However, this was basically fixed by accident for me and I think it would be good if the error message was improved help investigate these kind of issues.
sethdn commentedon Apr 1, 2017
Same issue. I may have a bad import but I can't tell because the UglifyJs error refers to a file that's never saved, I have no dist folder after this output. This also started for me after upgrading to cli 1.0 and angular 4.0
filipesilva commentedon May 3, 2017
I agree that it would be good to have better errors for this sort of stuff, but that's what UglifyJS gives us. Maybe we can replace it with something else in the future.
steveschmitt commentedon May 5, 2017
If you add the sourcemaps flag, e.g.
ng build --prod -sm, then the error shows the source file line causing the problem, instead of just the bundle line.TeaTimeForever commentedon May 16, 2017
For me helps @calbot solution. I also have used text-mask-core source code instead of dist (utilities have many useful functions).
filipesilva commentedon May 16, 2017
@steveschmitt ah of course, I didn't think of that at all.
--proddefaults to no sourcemaps, so without turning them on there isn't a way to get the source. That's the real answer. Cheers!yaahor commentedon May 24, 2017
When I run global angular-cli@1.0.4
ng build -prod, then building complete successfully. But when I try to run local angular-cli@1.0.4node_modules\.bin\ng build -prod, then error is thrownERROR in vendor.c6a3588f344ea41b381f.bundle.js from UglifyJs Unexpected token: name (Simple) [vendor.c6a3588f344ea41b381f.bundle.js:8858,6].File tsconfig.json:
File tsconfig.app.json:
Can somebody explain why is this happening?
calbot commentedon May 24, 2017
21 remaining items
youssefgh commentedon Oct 27, 2017
I moved to cli 1.5.0-rc.2 as a workaround until 1.5 is released
For anyone having the same problem here is my changes:
Thanks a lot guys for you help ;)
FrancescoBorzi commentedon Nov 13, 2017
I got the same issue using 1.5. I tried both
ng build --prod --aotandng build --prod --aot false. The error says:Unexpected token: name (MyService) [main.9ccecc27d4a5724997c5.bundle.js:20,6youssefgh commentedon Nov 13, 2017
@ShinDarth i no longer have this issue using 1.5 and even without using --aot. I think you have a different problem
can you make sure that target is set to "es2015" in tsconfig.json ?
if you still have the same issue try building with : ng build --prod --sm to see what lib is causing your error
FrancescoBorzi commentedon Nov 14, 2017
@youssefgh I did it, in my case it's not a lib but my source code
youssefgh commentedon Nov 14, 2017
@ShinDarth then (i think) just changing the es6+ syntax in your code to a ES2015 compliant should resolve your problem see above comment :
FrancescoBorzi commentedon Nov 14, 2017
yes I used
--smflag to check which line of my code is actually causing it, but it's this line:youssefgh commentedon Nov 14, 2017
That is weird that a simple class in an angular project can cause this
Can you share a sample project that reproduce this error ?
FrancescoBorzi commentedon Nov 14, 2017
@youssefgh I'm not able to reproduce the problem in other projects. Actually I'm even having troubles in reproducing it with the same project across different machines...
iamonuwa commentedon Dec 3, 2017
I solved mine by removing repeated codes inside my assets folder.
BBlackwo commentedon Aug 30, 2018
For those interested in Angular CLI v6.* the flag is now
--source-map.For me, source maps helped me identify a trailing comma in my function parameters that was breaking uglifyJS 🤷♂️.
kengneruphine commentedon Oct 1, 2018
Hello ,
Here is the error i face after running ng build --prod.
Please can someone help me out!!
ERROR in 10.ef56b443a514b22853bd.chunk.js from UglifyJs
TypeError: Cannot set property 'fixed' of undefined
at TreeWalker.eval [as visit] (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :5584:25)
at TreeWalker._visit (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :1339:24)
at AST_This._walk (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :480:24)
at AST_Dot.eval (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :1061:29)
at TreeWalker._visit (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :1343:21)
at AST_Dot._walk (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :1060:24)
at AST_Dot.walk (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :483:21)
at TreeWalker.eval [as visit] (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :5722:31)
at TreeWalker._visit (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :1339:24)
at AST_ForIn._walk (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :653:24)
at walk_body (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :530:17)
at AST_Function.eval (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :771:13)
at eval (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :1340:21)
at TreeWalker.eval [as visit] (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :5665:21)
at TreeWalker._visit (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :1339:24)
at AST_Function._walk (eval at (/home/ruphine/FineractCN/integration-tests/fineract-cn-fims-web-app/node_modules/webpack/node_modules/uglify-js/tools/node.js:27:1), :765:24)
hpardess commentedon Dec 5, 2018
I had following error,
and it is fixed with
ng build --prod --source-maplater I get heap error and
node --max_old_space_size=12000 ./node_modules/.bin/ng build --prod --source-mapcommand solved that too.angular-automatic-lock-bot commentedon Sep 9, 2019
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.