npm run prod fail
See original GitHub issue-
Laravel Mix Version: 1.7.2
-
Npm list: ├── axios@0.17.1 ├── bootstrap@4.0.0-beta.3 ├── browser-sync@2.22.0 ├── browser-sync-webpack-plugin@1.2.0 ├── cross-env@5.1.3 ├── jquery@3.2.1 ├── laravel-mix@1.7.2 ├── lodash@4.17.4 ├── popper.js@1.13.0 └── vue@2.5.13
-
Node Version: 8.9.3
-
NPM Version: 5.6.0
-
OS: OSX
Description:
npm run prod fail but npm run dev and watch work fine.
Npm debug log:
0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘run’, ‘prod’ ]
2 info using npm@5.6.0
3 info using node@v8.9.3
4 verbose run-script [ ‘preprod’, ‘prod’, ‘postprod’ ]
5 info lifecycle @~preprod: @
6 info lifecycle @~prod: @
7 verbose lifecycle @~prod: unsafe-perm in lifecycle true
8 verbose lifecycle @~prod: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/{username}/Code/{projectname}/node_modules/.bin:/Users/{username}/bin:/usr/local/bin:/Users/{username}/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle @~prod: CWD: /Users/{username}/Code/{projectname}
10 silly lifecycle @~prod: Args: [ ‘-c’, ‘npm run production’ ]
11 silly lifecycle @~prod: Returned: code: 1 signal: null
12 info lifecycle @~prod: Failed to exec prod script
13 verbose stack Error: @ prod: npm run production
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
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 emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid @
15 verbose cwd /Users/{username}/Code/{projectname}
16 verbose Darwin 16.7.0
17 verbose argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “prod”
18 verbose node v8.9.3
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error @ prod: npm run production
22 error Exit status 1
23 error Failed at the @ prod script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)

Top Related StackOverflow Question
This error seems to be due to the uglify options needing to be formatted like this:
This can be seen in the default mix config file here: https://github.com/JeffreyWay/laravel-mix/blob/master/src/config.js#L286
Ops! 😕 Now it works! Thank you @Nathanw