我在运行' npm run build'时遇到以下错误对于我的应用程序。
⠋ building for production.../home/edu/Dropbox/projects/personal/for good/musixshare/node_modules/last-call-webpack-plugin/src/index.js:170
compiler.hooks.compilation.tap(
^
TypeError: Cannot read property 'compilation' of undefined
at OptimizeCssAssetsWebpackPlugin.apply (/home/edu/Dropbox/projects/personal/for good/musixshare/node_modules/last-call-webpack-plugin/src/index.js:170:20)
at Compiler.apply (/home/edu/Dropbox/projects/personal/for good/musixshare/node_modules/tapable/lib/Tapable.js:375:16)
at webpack (/home/edu/Dropbox/projects/personal/for good/musixshare/node_modules/webpack/lib/webpack.js:33:19)
at err (/home/edu/Dropbox/projects/personal/for good/musixshare/build/build.js:19:3)
at next (/home/edu/Dropbox/projects/personal/for good/musixshare/node_modules/rimraf/rimraf.js:75:7)
at CB (/home/edu/Dropbox/projects/personal/for good/musixshare/node_modules/rimraf/rimraf.js:111:9)
at /home/edu/Dropbox/projects/personal/for good/musixshare/node_modules/rimraf/rimraf.js:137:14
at FSReqWrap.oncomplete (fs.js:152:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! musixshare@1.0.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the musixshare@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/edu/.npm/_logs/2018-05-25T17_24_14_199Z-debug.log
这是我得到的错误日志:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm@6.1.0
3 info using node@v8.11.2
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle musixshare@1.0.0~prebuild: musixshare@1.0.0
6 info lifecycle musixshare@1.0.0~build: musixshare@1.0.0
7 verbose lifecycle musixshare@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle musixshare@1.0.0~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/edu/Dropbox/projects/personal/for good/musixshare/node_modules/.bin:/home/edu/bin:/home/edu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle musixshare@1.0.0~build: CWD: /home/edu/Dropbox/projects/personal/for good/musixshare
10 silly lifecycle musixshare@1.0.0~build: Args: [ '-c', 'node build/build.js' ]
11 silly lifecycle musixshare@1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle musixshare@1.0.0~build: Failed to exec build script
13 verbose stack Error: musixshare@1.0.0 build: `node build/build.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304: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:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid musixshare@1.0.0
15 verbose cwd /home/edu/Dropbox/projects/personal/for good/musixshare
16 verbose Linux 4.13.0-43-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v8.11.2
19 verbose npm v6.1.0
20 error code ELIFECYCLE
21 error errno 1
22 error musixshare@1.0.0 build: `node build/build.js`
22 error Exit status 1
23 error Failed at the musixshare@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
我该如何解决这个问题?我可以跑'npm run dev&#39;通常,只是构建返回此错误。我已经尝试更新所有依赖项。
答案 0 :(得分:1)
我有解决方案,问题是webpack和optimize-css-assets-webpack-plugin之间不兼容。将软件包降级到v3.2.0已经修复了。