Quasar Build: ERROR in js/vendor.js from UglifyJs (Unexpected token: name (EventEmitter))



  • hey guys, I have been receiving an when I try use the quasar build command. The error message is

    ERROR in js/vendor.js from UglifyJs
    Unexpected token: name (EventEmitter) [js/vendor.js:45733,6]
    
    

    The quasar build command has been working properly up until recently. I checked the npm debug log and it stated the following

    0 info it worked if it ends with ok
    1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
    2 info using npm@5.5.1
    3 info using node@v9.2.0
    4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
    5 info lifecycle quasar-app@0.0.1~prebuild: quasar-app@0.0.1
    6 info lifecycle quasar-app@0.0.1~build: quasar-app@0.0.1
    7 verbose lifecycle quasar-app@0.0.1~build: unsafe-perm in lifecycle true
    8 verbose lifecycle quasar-app@0.0.1~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/musango/Documents/Projects/nightlifeapp/node_modules/.bin:/home/musango/bin:/home/musango/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/musango/.composer/vendor/bin:/home/musango/.composer/vendor/bin:/home/musango/.composer/vendor/bin
    9 verbose lifecycle quasar-app@0.0.1~build: CWD: /home/musango/Documents/Projects/nightlifeapp
    10 silly lifecycle quasar-app@0.0.1~build: Args: [ '-c', 'node build/script.build.js' ]
    11 silly lifecycle quasar-app@0.0.1~build: Returned: code: 1  signal: null
    12 info lifecycle quasar-app@0.0.1~build: Failed to exec build script
    13 verbose stack Error: quasar-app@0.0.1 build: `node build/script.build.js`
    13 verbose stack Exit status 1
    13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
    13 verbose stack     at EventEmitter.emit (events.js:159:13)
    13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
    13 verbose stack     at ChildProcess.emit (events.js:159:13)
    13 verbose stack     at maybeClose (internal/child_process.js:943:16)
    13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
    14 verbose pkgid quasar-app@0.0.1
    15 verbose cwd /home/musango/Documents/Projects/nightlifeapp
    16 verbose Linux 4.4.0-53-generic
    17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
    18 verbose node v9.2.0
    19 verbose npm  v5.5.1
    20 error code ELIFECYCLE
    21 error errno 1
    22 error quasar-app@0.0.1 build: `node build/script.build.js`
    22 error Exit status 1
    23 error Failed at the quasar-app@0.0.1 build script.
    23 error This is probably not a problem with npm. There is likely additional logging output above.
    24 verbose exit [ 1, true ]
    

    Help would be greatly appreciated,

    Thanks in advanced 🙂



  • Hey guys, same problem…

    ± quasar build

    dentcal@0.0.2 build /Users/joseph/Work/vex/vex4cal-frontend/dentcal
    node build/script.build.js

    WARNING!
    Do NOT use VueRouter’s “history” mode if
    building for Cordova or Electron.

    Cleaned build artifacts.

    Building Quasar App with “mat” theme…

    [================== ] 91% (additional chunk assets processing)Total precache size is about 1.82 MB for 15 resources.
    Build completed in 8.652s

    Hash: 6ae168da969630fdb57c
    Version: webpack 3.8.1
    Time: 8656ms
    Asset Size Chunks Chunk Names
    statics/icons/favicon-16x16.png 1.35 kB [emitted]
    fonts/MaterialIcons-Regular.012cf6a.woff 57.6 kB [emitted]
    js/vendor.js 1.44 MB 0 [emitted] [big] vendor
    js/app.js 20.6 kB 1 [emitted] app
    js/manifest.js 1.42 kB 2 [emitted] manifest
    app.c7c50518a96814f8a04ab8293d3ac41b.css 198 kB 1 [emitted] app
    index.html 2.23 kB [emitted]
    img/calendar-icon-full.ca2ba19.png 27.2 kB [emitted]
    statics/icons/favicon-32x32.png 2.6 kB [emitted]
    statics/icons/apple-icon-152x152.png 13.2 kB [emitted]
    statics/icons/icon-192x192.png 10.5 kB [emitted]
    statics/icons/ms-icon-144x144.png 12.3 kB [emitted]
    statics/icons/icon-512x512.png 29.7 kB [emitted]
    statics/manifest.json 418 bytes [emitted]
    statics/quasar-logo.png 7.2 kB [emitted]

    ERROR in js/vendor.js from UglifyJs
    Unexpected token: name (s) [js/vendor.js:42493,10]
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! dentcal@0.0.2 build: node build/script.build.js
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the dentcal@0.0.2 build script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR! /Users/joseph/.npm/_logs/2017-12-20T08_30_58_611Z-debug.log



  • I’m getting the same error while building my application, any idea what the problem might be?



  • Hi, did you find a solution? I need to put the app in production ASAP.
    Using quasar 0.14.10 and CLI 0.6.5 but at this time I cannot migrate to quasar 0.15.
    Using node 6.11. Errors get even worse when using node 8.4.



  • I had the same. I think, this is why

    Uglify cannot parse ES6, it will throw you syntax errors. Either set TypeScript to target ES5, post-process your generated JS with babel, or use a different minifier.

    I don’t remember details, but the issue was caused by some js package not really “compatible”. Again IIRC I managed to fix the issue tweaking the build process using this https://github.com/webpack-contrib/babel-minify-webpack-plugin.

    If there is any expert in this field (I’m not), please chip in and help. Thank you.



  • @pd76 thanks for the reply. Yes, I found the cause to be that I upgraded a dependency (feathersJS client v3) whose dist is in ES6. So for now, I downgraded it. But I will take a look at babel-minify-webpack soon. Thank you.