SimulatedGREG / electron-vue

An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
https://simulatedgreg.gitbooks.io/electron-vue/content/
MIT License
15.47k stars 1.54k forks source link

UglifyJs Error (unexpected token) #100

Closed manuelro closed 7 years ago

manuelro commented 7 years ago

Found an issue or bug? Tell me all about!

Describe the issue / bug.

While building the console prints an error

ERROR in build.js from UglifyJs
SyntaxError: Unexpected token: operator (>) [./app/~/aggregate-error/index.js:5,0]

ERROR in build.js from UglifyJs
SyntaxError: Unexpected token: operator (>) [./app/~/aggregate-error/index.js:5,0]
Child html-webpack-plugin for "index.html":
        + 3 hidden modules

Building electron app(s)...

Cannot create symlinks (on Windows hosts, it requires admin privileges); skipping darwin platform
Packaging app for platform linux x64 using electron v1.4.15
Cannot create symlinks (on Windows hosts, it requires admin privileges); skipping mas platform
Packaging app for platform win32 x64 using electron v1.4.15
Build(s) successful!
[ 'D:\\Documents\\Projects\\box\\box-desktop-vue\\boxscreen-app\\builds\\Boxscreen-linux-x64',
  'D:\\Documents\\Projects\\box\\box-desktop-vue\\boxscreen-app\\builds\\Boxscreen-win32-x64' ]

DONE

Although it says that the build was successful, it is not, it just keeps the previously built version of the app.

How can I reproduce this problem?

The error started happening when I installed npm install --save socket.io-client in the app/package.json, I guess this package uses Uglify. So, I guess this is perhaps an issue with Webpack configuration and the ES5/ES6 versions the builder is trying to package for.

If visual, provide a screenshot.

http://imgur.com/a/vFR9A

Tell me about your development environment.

If you are looking to suggest an enhancement or feature, then feel free to remove everything above.

manuelro commented 7 years ago

UPDATE: I was first using electron-packager. I created a new project but this time with electron-builder, installed all the very same npm packages, implemented the very same code and built the app, no errors. This seems to be an error with electron-packager, and not with electron-vue boilerplate.

SimulatedGREG commented 7 years ago

There are a lot of major changes within the recent Multiplex update. I was actually going to ask you to try the new update, since it treats all dependencies as webpack externals. Because of this, npm modules are required directly from node_modules and no longer bundled together in one file.

SimulatedGREG commented 7 years ago

I'm assuming things are resolved for you now. Feel free to comment back for any other questions. Closing.

wdmtech commented 7 years ago

I am also seeing this error when running npm run pack:renderer.

I copied my entire src folder over to the latest (stable) electron-vue generated boilerplate project and still see the same - guessing something in my app/package.json isn't being uglified correctly? I'm not quite sure where to begin with the error output.

(list of dependencies in app/package.json included below the error output)

d:\Dev\outatime-ui (master) (outatime-ui@0.0.0)
λ npm run pack:renderer

> outatime-ui@0.0.0 pack:renderer d:\Dev\outatime-ui
> cross-env NODE_ENV=production webpack -p --progress --colors --config webpack.renderer.config.js

 11% building modules 14/19 modules 5 active ...p\src\renderer\vuex\modules\_index.js(node:5768) DeprecationWarning: loaderUtils.parseQuery() received a non-string val
ue which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
Hash: a99ade016d1ddf734e8c
Version: webpack 2.5.1
Time: 6313ms
   [2] ./app/~/babel-runtime/helpers/extends.js 544 bytes {0} [built]
   [5] ./~/vue-loader/lib/component-normalizer.js 1.12 kB {0} [built]
  [42] ./app/~/babel-runtime/core-js/object/assign.js 94 bytes {0} [built]
  [61] ./app/src/renderer/vuex/modules/_index.js 310 bytes {0} [built]
  [62] ./app/src/renderer/filters.js 306 bytes {0} [built]
  [63] ./app/src/renderer/routes.js 536 bytes {0} [built]
  [64] ./app/src/renderer/vuex/store.js 313 bytes {0} [built]
  [65] ./app/src/renderer/App.vue 933 bytes {0} [built]
 [139] ./app/src/renderer/main.js 605 bytes {0} [built]
 [147] ./app/src/renderer/vuex/plugins.js 137 bytes {0} [built]
 [148] ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./app/src/renderer/App.vue 1.3 kB {0} [built]
 [156] ./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-5227baaa!./~/sass-loader/lib/loader.js?indentedSyntax=1!./~/vue-loader/lib/selector.js?type=styles
&index=0!./app/src/renderer/App.vue 95.1 kB {0} [built]
 [181] ./~/vue-loader/lib/template-compiler.js?id=data-v-5227baaa!./~/vue-loader/lib/selector.js?type=template&index=0!./app/src/renderer/App.vue 899 bytes {0} [built]

 [189] ./~/vue-loader/~/vue-style-loader!./~/css-loader?minimize!./~/vue-loader/lib/style-rewriter.js?id=data-v-5227baaa!./~/vue-loader/lib/selector.js?type=styles&ind
ex=1!./app/src/renderer/App.vue 607 bytes {0} [built]
 [194] ./~/vue-style-loader!./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-5227baaa!./~/sass-loader/lib/loader.js?indentedSyntax=1!./~/vue-loader/lib/se
lector.js?type=styles&index=0!./app/src/renderer/App.vue 1.54 kB {0} [built]
    + 189 hidden modules

ERROR in renderer.js from UglifyJs
Unexpected token: operator (>) [renderer.js:5224,37]

ERROR in renderer.js from UglifyJs
Unexpected token: operator (>) [renderer.js:5224,37]
Child html-webpack-plugin for "index.html":
       [0] ./~/lodash/lodash.js 540 kB {0} [built]
       [1] ./~/html-webpack-plugin/lib/loader.js!./app/index.ejs 1.02 kB {0} [built]
       [2] (webpack)/buildin/module.js 517 bytes {0} [built]

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs7\\node.exe" "C:\\Program Files\\nodejs7\\node_modules\\npm\\bin\\npm-cli.js" "run" "pack:renderer"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! outatime-ui@0.0.0 pack:renderer: `cross-env NODE_ENV=production webpack -p --progress --colors --config webpack.renderer.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the outatime-ui@0.0.0 pack:renderer script 'cross-env NODE_ENV=production webpack -p --progress --colors --config webpack.renderer.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the outatime-ui package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cross-env NODE_ENV=production webpack -p --progress --colors --config webpack.renderer.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs outatime-ui
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls outatime-ui
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Will.Murray\AppData\Roaming\npm-cache\_logs\2017-05-12T10_22_39_123Z-debug.log

image

    "animate.css": "^3.5.2",
    "babel-runtime": "^6.23.0",
    "bulma": "^0.4.0",
    "element-ui": "^1.2.9",
    "feathers": "^2.1.1",
    "feathers-authentication-client": "^0.3.1",
    "feathers-hooks": "^1.8.1",
    "feathers-socketio": "^1.5.2",
    "font-awesome": "^4.7.0",
    "jspdf": "^1.3.3",
    "menubar": "^5.2.3",
    "moment": "^2.17.1",
    "moment-range": "^3.0.3",
    "pluralize": "^3.1.0",
    "socket.io-client": "^1.7.3",
    "vue": "^2.1.10",
    "vue-bulma-datepicker": "^1.3.2",
    "vue-bulma-tooltip": "github:vue-bulma/tooltip",
    "vue-electron": "^1.0.6",
    "vue-moment": "^2.0.2",
    "vue-resource": "^1.0.3",
    "vue-router": "^2.1.2",
    "vue2-timepicker": "^0.1.4",
    "vuex": "^2.1.1"

Node version: v7.10.0 NPM version: 4.2.0 Operating System: Windows 7

wdmtech commented 7 years ago

Disabling my code that uses socket.io-client seems to have no effect