Laravel-mix: npm run production error.

Created on 13 Jan 2017  路  5Comments  路  Source: JeffreyWay/laravel-mix

 ERROR  Failed to compile with 1 errors

 error  

js/app.js from UglifyJs
SyntaxError: Unexpected token punc 芦(禄, expected punc 芦:禄 [js/app.js:13477,11]

    Asset    Size  Chunks                    Chunk Names
js/app.js  1.3 MB       0  [emitted]  [big]  app

npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "production"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] production: `cross-env NODE_ENV=production webpack --progress --hide-modules`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] production script 'cross-env NODE_ENV=production webpack --progress --hide-modules'.
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 ecampus 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 --progress --hide-modules
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ecampus
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ecampus
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /opt/lampp/htdocs/ecampus/npm-debug.log

npm debug log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'production' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preproduction', 'production', 'postproduction' ]
5 info lifecycle [email protected]~preproduction: [email protected]
6 silly lifecycle [email protected]~preproduction: no script for preproduction, continuing
7 info lifecycle [email protected]~production: [email protected]
8 verbose lifecycle [email protected]~production: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~production: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/opt/lampp/htdocs/ecampus/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle [email protected]~production: CWD: /opt/lampp/htdocs/ecampus
11 silly lifecycle [email protected]~production: Args: [ '-c',
11 silly lifecycle 'cross-env NODE_ENV=production webpack --progress --hide-modules' ]
12 silly lifecycle [email protected]~production: Returned: code: 2 signal: null
13 info lifecycle [email protected]~production: Failed to exec production script
14 verbose stack Error: [email protected] production: cross-env NODE_ENV=production webpack --progress --hide-modules
14 verbose stack Exit status 2
14 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /opt/lampp/htdocs/ecampus
17 error Linux 4.4.0-59-generic
18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "production"
19 error node v6.9.4
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error [email protected] production: cross-env NODE_ENV=production webpack --progress --hide-modules
22 error Exit status 2
23 error Failed at the [email protected] production script 'cross-env NODE_ENV=production webpack --progress --hide-modules'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the ecampus package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error cross-env NODE_ENV=production webpack --progress --hide-modules
23 error You can get information on how to open an issue for this project with:
23 error npm bugs ecampus
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls ecampus
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

```

Most helpful comment

I fixed it by installing the latest babel preset https://babeljs.io/docs/plugins/preset-latest/

All 5 comments

every time I compile using
npm run webpack or
npm run production

the script files I get are the older one that is not updated.
the only thing that works is npm run hmr.
even if I delete the app.js and compile it again.

I fixed it by installing the latest babel preset https://babeljs.io/docs/plugins/preset-latest/

adding this to my package.json finally made that error go away

"uglify-js": "git+https://github.com/mishoo/UglifyJS2.git#harmony",

Upgrading to [email protected] solved the problem for me

@iraklisg You should have upgraded before commenting. This issue was closed since January this year. It's been a while and there were many updates to laravel-mix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Micaso picture Micaso  路  3Comments

jpmurray picture jpmurray  路  3Comments

Bomavi picture Bomavi  路  3Comments

sdebacker picture sdebacker  路  3Comments

jpriceonline picture jpriceonline  路  3Comments