无法使用npm run build构建我的Vuejs应用程序

时间:2019-07-02 10:29:32

标签: vue.js webpack

当我在Vuejs应用程序中运行npm run build时,出现以下错误:

compiler.hooks.compilation.tap(
^
TypeError: Cannot read property 'compilation' of undefined
at OptimizeCssAssetsWebpackPlugin.apply (C:\Users\EFOSA\Desktop\my_project\client\node_modules\last-call-webpack-plugin\src\index.js:170:20)
at Compiler.apply (C:\Users\EFOSA\Desktop\my_project\client\node_modules\tapable\lib\Tapable.js:375:16)
at webpack (C:\Users\EFOSA\Desktop\my_project\client\node_modules\webpack\lib\webpack.js:33:19)
at err (C:\Users\EFOSA\Desktop\my_project\client\build\build.js:19:3)
at next (C:\Users\EFOSA\Desktop\my_project\client\node_modules\rimraf\rimraf.js:75:7)
at CB (C:\Users\EFOSA\Desktop\my_project\client\node_modules\rimraf\rimraf.js:111:9)
at C:\Users\EFOSA\Desktop\my_project\client\node_modules\rimraf\rimraf.js:137:14
at FSReqWrap.oncomplete (fs.js:154:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my_project@1.0.0 build: node build/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my_project@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! C:\Users\EFOSA\AppData\Roaming\npm-cache_logs\2019-07-02T07_51_40_908Z-debug.log

我正在运行webpack 3.12。 有人可以帮我吗?

1 个答案:

答案 0 :(得分:1)

您的配置和/或插件版本存在问题。查看optimize-css-assets-webpack-plugin文档:

  

对于Webpack v3或更低版本,请使用   优化css-assets-webpack-plugin@3.2.0。的   支持optimize-css-assets-webpack-plugin@4.0.0及更高版本   webpack v4。