【发布时间】:2019-06-28 14:49:00
【问题描述】:
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 ]
【问题讨论】:
-
你能展示脚本“生产”的作用吗?
-
在上面的编辑中添加了它
-
谢谢@MihirBhende,我刚刚摆脱了
package-lock.json并重新运行npm run production并且成功了。
标签: laravel vue.js npm webpack laravel-mix