Cannot read property 'tap' of undefined

E:\vue-project\vue-element-admin-master>npm run build:prod

[email protected] build:prod E:\vue-project\vue-element-admin-master
cross-env NODE_ENV=production env_config=prod node build/build.js

  • building for prod environment...E:\vue-project\vue-element-admin-master\node_modules\script-ext-html-webpack-plugin\lib\plugin.js:50
    compilation.hooks.htmlWebpackPluginAlterAssetTags.tap(PLUGIN, alterAssetTags);
    ^

TypeError: Cannot read property 'tap' of undefined
at ScriptExtHtmlWebpackPlugin.compilationCallback (E:\vue-project\vue-element-admin-master\node_modules\script-ext-html-webpack-plugin\lib\plugin.js:50:57)
at SyncHook.eval [as call] (eval at create (E:\vue-project\vue-element-admin-master\node_modules\tapable\lib\HookCodeFactory.js:17:12), :11:1)
at SyncHook.lazyCompileHook [as _call] (E:\vue-project\vue-element-admin-master\node_modules\tapable\lib\Hook.js:35:21)
at Compiler.newCompilation (E:\vue-project\vue-element-admin-master\node_modules\webpack\lib\Compiler.js:504:26)
at hooks.beforeCompile.callAsync.err (E:\vue-project\vue-element-admin-master\node_modules\webpack\lib\Compiler.js:540:29)
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\vue-project\vue-element-admin-master\node_modules\tapable\lib\HookCodeFactory.js:24:12), :6:1)
at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\vue-project\vue-element-admin-master\node_modules\tapable\lib\Hook.js:35:21)
at Compiler.compile (E:\vue-project\vue-element-admin-master\node_modules\webpack\lib\Compiler.js:535:28)
at readRecords.err (E:\vue-project\vue-element-admin-master\node_modules\webpack\lib\Compiler.js:274:11)
at Compiler.readRecords (E:\vue-project\vue-element-admin-master\node_modules\webpack\lib\Compiler.js:402:11)
at hooks.run.callAsync.err (E:\vue-project\vue-element-admin-master\node_modules\webpack\lib\Compiler.js:271:10)
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\vue-project\vue-element-admin-master\node_modules\tapable\lib\HookCodeFactory.js:24:12), :6:1)
at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\vue-project\vue-element-admin-master\node_modules\tapable\lib\Hook.js:35:21)
at hooks.beforeRun.callAsync.err (E:\vue-project\vue-element-admin-master\node_modules\webpack\lib\Compiler.js:268:19)
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\vue-project\vue-element-admin-master\node_modules\tapable\lib\HookCodeFactory.js:24:12), :15:1)
at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\vue-project\vue-element-admin-master\node_modules\tapable\lib\Hook.js:35:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:prod: cross-env NODE_ENV=production env_config=prod node build/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:prod 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\Administrator\AppData\Roaming\npm-cache_logs\2018-09-05T05_37_15_612Z-debug.log

解决方法:

  • set "html-webpack-plugin": "^4.0.0-alpha" => "4.0.0-alpha"
  • remove node_modules
  • remove package-lock.json
  • npm install

猜你喜欢

转载自www.cnblogs.com/ybz94/p/9625864.html