Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ara's avatar
Level 3

NPM run prod fails

Everything was working but for some reason, something broke last night.

Every time, I deploy, the npm run prod fails. In the console log of envoyer, I can't see the issue because it runs for a while before it fails. When I try to run manually, locally and on my staging, it works fine...

I am so confused at the moment...Is there a way to see my error logs? I found some logs in ~/.npm/_logs but those logs are only showing this:

0 info it worked if it ends with ok

1 verbose cli \[ '/usr/bin/node',

1 verbose cli   '/usr/bin/npm',

1 verbose cli   'run',

1 verbose cli   'production',

1 verbose cli   '--loglevel',

1 verbose cli   'verbose' \]

2 info using [email protected]

3 info using [email protected]

4 verbose run-script \[ 'preproduction', 'production', 'postproduction' \]

5 info lifecycle @\~preproduction: @

6 info lifecycle @\~production: @

7 verbose lifecycle @\~production: unsafe-perm in lifecycle true

8 verbose lifecycle @\~production: PATH: /usr/lib/node\_modules/npm/node\_modules/npm-lifecycle/node-gyp-bin:/home/forge/ccp.kin-ball.qc.ca/releases/20190924191232/node\_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

9 verbose lifecycle @\~production: CWD: /home/forge/ccp.kin-ball.qc.ca/releases/20190924191232

10 silly lifecycle @\~production: Args: \[ '-c',

10 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' \]

11 silly lifecycle @\~production: Returned: code: 1  signal: null

12 info lifecycle @\~production: Failed to exec production script

13 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\`

13 verbose stack Exit status 1

13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node\_modules/npm/node\_modules/npm-lifecycle/index.js:301: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/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:915:16)

13 verbose stack     at Process.ChildProcess.\_handle.onexit (internal/child\_process.js:209:5)

14 verbose pkgid @

15 verbose cwd /home/forge/ccp.kin-ball.qc.ca/releases/20190924191232

16 verbose Linux 4.4.0-161-generic

17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "production" "--loglevel" "verbose"

18 verbose node v8.16.1

19 verbose npm  v6.4.1

20 error code ELIFECYCLE

21 error errno 1

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 1

23 error Failed at the @ production script.

23 error This is probably not a problem with npm. There is likely additional logging output above.

24 verbose exit \[ 1, true \]

But it can't be a cross-env issue if it's working fine on locally right?

0 likes
1 reply
Sammyjo20's avatar

What version of Node are you using? I typically get this error for a range of reasons but the main one is when you are using a different version of node. Try deleting your node modules folder rm -rf node_modules, run npm i and see if it solves anything! 👍

Please or to participate in this conversation.