Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng build -prod unexpected token: name (BroccoliPlugin BundlePlugin failed), JS_PARSE_ERROR #1333

Closed
dessalines opened this issue Jul 12, 2016 · 7 comments

Comments

@dessalines
Copy link

angular-cli: 1.0.0-beta.9
node: 6.2.2
os: linux x64

I recently update my project, and started using typescript target="es6", and now ng build -prod is failing. I haven't changed anything having to do with the classes involved:

ng build -prod
(node:4183) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
⠹ Building"{{content-for}}" has been deprecated and will be removed before RC.
Build failed.
The Broccoli Plugin: [BundlePlugin] failed with:
Error: SyntaxError: Unexpected token: name (Ng2WebSocket) (line: 18884, col: 6, pos: 762066)

Error
    at new JS_Parse_Error (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1545:18)
    at js_error (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1553:11)
    at croak (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2089:9)
    at token_error (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2097:9)
    at unexpected (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2103:9)
    at semicolon (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2123:56)
    at simple_statement (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2314:73)
    at eval (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2183:19)
    at eval (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2136:24)
    at block_ (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2429:20)
    at eval (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2401:25)
    at function_ (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2407:15)
    at expr_atom (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2622:24)
    at maybe_unary (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2792:19)
    at expr_ops (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2827:24)
    at maybe_conditional (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2832:20)
    at maybe_assign (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2856:20)
    at expression (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2875:20)
    at expr_list (eval at <anonymous> (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2641:24)
    at minify (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/lib/output.js:79:11)
    at exports.writeOutputs (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/lib/output.js:153:14)
    at /home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:627:14
    at tryCatcher (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:504:31)
    at Promise._settlePromise (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:561:18)
    at Promise._settlePromise0 (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:606:10)
    at Promise._settlePromises (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:685:18)
    at Async._drainQueue (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/node_modules/bluebird/js/release/async.js:138:16)
    at Async._drainQueues (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/node_modules/bluebird/js/release/async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/systemjs-builder/node_modules/bluebird/js/release/async.js:17:14)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

The broccoli plugin was instantiated at: 
    at BundlePlugin.Plugin (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/broccoli-plugin/index.js:10:31)
    at BundlePlugin.CachingWriter [as constructor] (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
    at BundlePlugin (/home/tyler/git/flowchat/ui/node_modules/angular-cli/lib/broccoli/angular-broccoli-bundle.js:11:5)
    at Angular2App._getBundleTree (/home/tyler/git/flowchat/ui/node_modules/angular-cli/lib/broccoli/angular2-app.js:435:22)
    at Angular2App._buildTree (/home/tyler/git/flowchat/ui/node_modules/angular-cli/lib/broccoli/angular2-app.js:167:21)
    at new Angular2App (/home/tyler/git/flowchat/ui/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
    at module.exports (/home/tyler/git/flowchat/ui/angular-cli-build.js:6:10)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
    at Class.module.exports.Task.extend.init (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
    at new Class (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
    at Class.module.exports.Task.extend.run (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
    at /home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24
    at lib$rsvp$$internal$$tryCatch (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
    at /home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
    at lib$rsvp$asap$$flush (/home/tyler/git/flowchat/ui/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
@dessalines
Copy link
Author

I can verify that this issue only exists when using tsconfig : target: es6

@mlynam
Copy link

mlynam commented Jul 14, 2016

I'm getting the same behavior after bumping to es6.

@dessalines
Copy link
Author

The only way I could fix this was to revert back to es5, and fix other problems.

@mlynam
Copy link

mlynam commented Jul 15, 2016

I changed my module to es6 while targeting es6 and received a more verbose error from the cli. Turns out I had a module import syntax error in one of my source files. I fixed the error and can now ng build -prod successfully.

@filipesilva
Copy link
Contributor

Closed as issue was made obsolete by #1455.

@dessalines
Copy link
Author

Thanks.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants