question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when 'npm run production'

See original GitHub issue

Help, pleace… Whole day headache 😦

  • Laravel Mix Version: ├── axios@0.15.3 ├── bootstrap-sass@3.3.7 ├── cross-env@3.2.4 ├── jquery@3.2.1 ├── laravel-mix@0.12.0 ├── lodash@4.17.4 ├── medium-editor@5.23.0 ├── vue@2.3.3 ├── vue-axios@2.0.2 ├── vue-events@3.0.1 └── vue-strap@2.0.2 (git://github.com/wffranco/vue-strap.git#02b471c8b99a509ff4f9e6064495133288c781fe)

  • Node Version: v6.10.3

  • NPM Version:v3.10.10

  • OS: MACOs Siera

Description: Error when ‘npm run production’

> npm ERR! Darwin 16.5.0
> npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "production"
> npm ERR! node v6.10.3
> npm ERR! npm  v3.10.10
> npm ERR! code ELIFECYCLE
> npm ERR! @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
> npm ERR! Exit status 2
> npm ERR! 
> npm ERR! Failed at the @ production script 'cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.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  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 node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
> npm ERR! You can get information on how to open an issue for this project with:
> npm ERR!     npm bugs 
> npm ERR! Or if that isn't available, you can get their info via:
> npm ERR!     npm owner ls 
> npm ERR! There is likely additional logging output above.
> 
> npm ERR! Please include the following file with any support request:
> npm ERR!     /Users/valentin/Desktop/www/jobs/npm-debug.log

=========== npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'production' ]
2 info using npm@3.10.10
3 info using node@v6.10.3
4 verbose run-script [ 'preproduction', 'production', 'postproduction' ]
5 info lifecycle @~preproduction: @
6 silly lifecycle @~preproduction: no script for preproduction, continuing
7 info lifecycle @~production: @
8 verbose lifecycle @~production: unsafe-perm in lifecycle true
9 verbose lifecycle @~production: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/valentin/Desktop/www/jobs/node_modules/.bin:/Applications/MAMP/bin/php/php7.0.15/bin:vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/valentin/.composer/vendor/bin:/Users/valentin/bin:/Users/valentin/.composer/vendor/bin
10 verbose lifecycle @~production: CWD: /Users/valentin/Desktop/www/jobs
11 silly lifecycle @~production: Args: [ '-c',
11 silly lifecycle   'cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
12 silly lifecycle @~production: Returned: code: 2  signal: null
13 info lifecycle @~production: Failed to exec production script
14 verbose stack Error: @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
14 verbose stack Exit status 2
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/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.<anonymous> (/usr/local/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:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid @
16 verbose cwd /Users/valentin/Desktop/www/jobs
17 error Darwin 16.5.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "production"
19 error node v6.10.3
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 2
23 error Failed at the @ production script 'cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
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  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 node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
msonowalcommented, May 26, 2017

@lotestudio I fixed it by adding this to a newly created file .babelrc {"presets": [ ["env", { "targets": { "uglify": false } }] ]}

5reactions
adiachenkocommented, May 26, 2017

Do you use Yarn or npm shrinkwrap by any chance?

It may be that some locked dependencies haven’t updated properly. Try to delete node_modules folder and then do simple stupid npm install.

I had ELIFECYCLE error after upgrading to 0.12, Then if I recall correctly I performed the following sequence of actions:

yarn remove laravel-mix
yarn add laravel-mix
yarn remove cross-env
yarn add cross-env

Weirdly, the issue was gone after purging the old cross-env.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error npm run production - Laracasts
Wehn running npm production get error like bellow: Copy Code [hrace009@ko2svr hrace009.com]$ npm run prod > @ prod /var/www/hrace009.com > npm run ......
Read more >
Failed at the @ production script. Error running npm run ...
It was issue with my node_modules folder. there were some extra useless packages so simply i just deleted node_modules and install it again ......
Read more >
Error when 'npm run production' · Issue #836 · laravel-mix ...
It may be that some locked dependencies haven't updated properly. Try to delete node_modules folder and then do simple stupid npm install. I...
Read more >
How To Fix “Laravel Mix NPM run dev error” - YouTube
This video will help you to solve the annoying “Laravel Mix NPM run dev error ” that you probably have seen before when...
Read more >
npm run dev is showing error on existing Laravel Project
Error [ERR_REQUIRE_ESM]: require() of ES Module [laravelApp]/node_modules/del/index.js from [laravelApp]/webpack.mix.js not supported. Instead change the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found