npm run production
未成功运行。我试图删除node_modules文件夹并运行npm install
,但仍然没有任何操作。
我也尝试从系统中卸载并安装npm,但仍然遇到相同的问题。
但是手表运行良好,但无法生产。
生产脚本可以:
"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",
我正在使用npm 6.7.0版本和nodejs 8.11.4版本 该脚本在npm错误日志中控制台了以下错误:
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 ]
答案 0 :(得分:0)
删除package-lock.json
rm package-lock.json
然后使用以下命令重新运行编译:
npm run production
答案 1 :(得分:0)
我遇到了同样的问题,因为我曾经将MIX_SENTRY_DSN_PUBLIC
放在这样的webpack中(不工作):
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');
代替:
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');