2

npm run production doesn't run successfully. I have tried to remove the node_modules folder and run npm install but nothing still. I have also tried to uninstall and install npm from the system but I still am having the same issue.

But watch is running fine but not production.

production script does:

    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",

I am using npm version 6.7.0 and nodejs version 8.11.4 The script consoles the following error in the npm error log:

0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'prod' ] 2 info using npm@6.7.0 3 info using node@v8.11.4 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:/var/www/html/****/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games 9 verbose lifecycle @~prod: CWD: /var/www/html/**** 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: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/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 /var/www/html/**** 16 verbose Linux 4.18.0-11-generic 17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "prod" 18 verbose node v8.11.4 19 verbose npm v6.7.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 ]

Johhn
  • 776
  • 9
  • 19

1 Answers1

0

I had same issue because I used to put MIX_SENTRY_DSN_PUBLIC in webpack like this (NOT WORKING):

mix.js('resources/js/app.js', process.env.MIX_SENTRY_DSN_PUBLIC/'public/js')
.sass('resources/sass/app.scss', process.env.MIX_SENTRY_DSN_PUBLIC/'public/css');

instead of:

 mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
ysf
  • 3,793
  • 3
  • 19
  • 24
novecentonove
  • 317
  • 2
  • 11