node編譯錯誤TypeError: Cannot read property 'compilation' of undefined

問題描述

/xxxxxxx/node_modules/last-call-webpack-plugin/src/index.js:170
    compiler.hooks.compilation.tap(
                   ^

TypeError: Cannot read property 'compilation' of undefined
    at OptimizeCssAssetsWebpackPlugin.apply (/xxxxxlast-call-webpack-plugin/src/index.js:170:20)
    at Compiler.apply (/xxxxx/node_modules/tapable/lib/Tapable.js:375:16)
    at webpack (xxx-/node_modules/webpack/lib/webpack.js:33:19)
    at err (/xxxxx/build/build.js:19:3)
    at next (/xxxx/node_modules/rimraf/rimraf.js:83:7)
    at CB (/xxxxx/node_modules/rimraf/rimraf.js:119:9)
    at /xxxxc/node_modules/rimraf/rimraf.js:145:14
    at FSReqWrap.oncomplete (fs.js:154:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-webpack@1.0.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vue-webpack@1.0.0 build script.

解決方法

1、找到package.json
確定webpack版本和optimize-css-assets-webpack-plugin
webpack是3.6.0  
optimize-css-assets-webpack-plugin(5.0.3) 應該修改爲3.2.0版本
運行 npm i [email protected]就刻印重新編譯了
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章