vatesfr / xen-orchestra

The global orchestration solution to manage and backup XCP-ng and XenServer.
https://xen-orchestra.com
Other
767 stars 262 forks source link

Build xo-web on Centos fails - GulpUglifyError: unable to minify JavaScript #1976

Closed Keithsc closed 7 years ago

Keithsc commented 7 years ago

Context

We are attempting to upgrade our xenorchestra from sources using our previous instructions We are using Centos 7. We are able to build xo-server fine but can't get xo-web to build.

If from the sources: git clone -b stable http://github.com/vatesfr/xo-server git clone -b stable http://github.com/vatesfr/xo-web

 npm run build

> xo-server@5.6.4 prebuild /root/xo-server
> index-modules src/api src/xapi/mixins src/xo-mixins

index generated src/api/index.js
index generated src/xapi/mixins/index.js
index generated src/xo-mixins/index.js

> xo-server@5.6.4 build /root/xo-server
> gulp build --production

[16:21:23] Using gulpfile ~/xo-server/gulpfile.js
[16:21:23] Starting 'build'...
[16:21:23] Starting 'clean'...
[16:21:23] Finished 'clean' after 73 ms
[16:21:23] Starting 'buildCoffee'...
[16:21:23] Starting 'buildEs6'...
[16:21:30] Finished 'buildCoffee' after 6.47 s
[16:21:52] Finished 'buildEs6' after 29 s
[16:21:52] Finished 'build' after 29 s
[root@XenOrchestra xo-server]# cd ../xo-web
[root@XenOrchestra xo-web]# npm install
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts will run only for `npm publish`.
npm WARN prepublish-on-install (In npm@4 and previous versions, it also runs for `npm install`.)
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
npm WARN lifecycle xo-web@5.6.1~prepublish: cannot run in wd %s %s (wd=%s) xo-web@5.6.1 npm run build /root/xo-web
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[root@XenOrchestra xo-web]# npm run build

> xo-web@5.6.1 build /root/xo-web
> npm run build-indexes && NODE_ENV=production gulp build

> xo-web@5.6.1 build-indexes /root/xo-web
> index-modules --auto src

index generated src/common/intl/locales/index.js
[16:22:35] Using gulpfile ~/xo-web/gulpfile.js
[16:22:35] Starting 'build'...
[16:22:35] Starting 'buildPages'...
[16:22:35] Starting 'buildScripts'...
[16:22:35] Starting 'buildStyles'...
[16:22:35] Starting 'copyAssets'...
[16:22:36] Finished 'buildPages' after 1.52 s
[16:22:40] Finished 'buildStyles' after 4.92 s
[16:22:40] Finished 'copyAssets' after 5.08 s
[16:24:05] 'buildScripts' errored after 1.5 min
[16:24:05] GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected character '`' (line: 98370, col: 13, pos: 3117237)

Error
    at new JS_Parse_Error (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:1547:18)
    at js_error (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:1555:11)
    at parse_error (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:1679:9)
    at Object.next_token [as input] (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:1951:9)
    at next (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2080:25)
    at eval (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2210:42)
    at eval (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2141:24)
    at block_ (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2434:20)
    at eval (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2406:25)
    at function_ (eval at <anonymous> (/root/xo-web/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2412:15)
[16:24:05] 'build' errored after 1.5 min

npm ERR! Linux 3.10.0-327.36.2.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.6.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! xo-web@5.6.1 build: `npm run build-indexes && NODE_ENV=production gulp build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xo-web@5.6.1 build script 'npm run build-indexes && NODE_ENV=production gulp build'.
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 xo-web package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build-indexes && NODE_ENV=production gulp build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs xo-web
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls xo-web
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/xo-web/npm-debug.log
julien-f commented 7 years ago

Thanks for your report.

Until it's fixed, you can use Node 6 and it should compile fine.

Danp2 commented 7 years ago

Tested with Node 6.1.0 and Node 6.9.2 with same results. It's something other than Node.js

julien-f commented 7 years ago

Probably a dependency update, you should use yarn to install them instead of npm, so you will have the same exact deps than us.

Danp2 commented 7 years ago

Thanks for the hint on yarn. Will definitely take a look at it.

iuriwjle commented 7 years ago

I also have this issue on debian jessie. But by using version 5.5.0 of xo-web i got a successful build.

Danp2 commented 7 years ago

@julien-f Built fine with yarn. ;-)

Fohdeesha commented 7 years ago

same problem on debian, also fixed by using yarn