解决:Cannot read property 'tap' of undefined
2019-01-09 16:08
549 查看
启动项目发现报错信息如下:
D:\study\blog-front-master\blog-front-master\node_modules\webpack\lib\ProgressPlugin.js:205 compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd); ^ TypeError: Cannot read property 'tap' of undefined at compiler.hooks.compilation.tap.compilation (D:\study\blog-front-master\blog-front-master\node_modules\webpack\lib\ProgressPlugin.js:205:32) at SyncHook.eval [as call] (eval at create (D:\study\blog-front-master\blog-front-master\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:9: 1) at SyncHook.lazyCompileHook (D:\study\blog-front-master\blog-front-master\node_modules\tapable\lib\Hook.js:154:20) at Compiler.newCompilation (D:\study\blog-front-master\blog-front-master\node_modules\next\node_modules\webpack\lib\Compiler.js:498:26) at hooks.beforeCompile.callAsync.err (D:\study\blog-front-master\blog-front-master\node_modules\next\node_modules\webpack\lib\Compiler.js:534:29) at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\study\blog-front-master\blog-front-master\node_modules\tapable\lib\HookCodeFactory.js:32:10), <a nonymous>:6:1) at AsyncSeriesHook.lazyCompileHook (D:\study\blog-front-master\blog-front-master\node_modules\tapable\lib\Hook.js:154:20) at Compiler.compile (D:\study\blog-front-master\blog-front-master\node_modules\next\node_modules\webpack\lib\Compiler.js:529:28) at compiler.hooks.watchRun.callAsync.err (D:\study\blog-front-master\blog-front-master\node_modules\next\node_modules\webpack\lib\Watching.js:77:18) at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\study\blog-front-master\blog-front-master\node_modules\tapable\lib\HookCodeFactory.js:32:10), <a nonymous>:24:1) at AsyncSeriesHook.lazyCompileHook (D:\study\blog-front-master\blog-front-master\node_modules\tapable\lib\Hook.js:154:20) at Watching._go (D:\study\blog-front-master\blog-front-master\node_modules\next\node_modules\webpack\lib\Watching.js:40:32) at Watching.compiler.readRecords.err (D:\study\blog-front-master\blog-front-master\node_modules\next\node_modules\webpack\lib\Watching.js:32:9) at Array.inputFileSystem.stat.err (D:\study\blog-front-master\blog-front-master\node_modules\next\node_modules\webpack\lib\Compiler.js:401:20) at Storage.finished (D:\study\blog-front-master\blog-front-master\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16) at provider (D:\study\blog-front-master\blog-front-master\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! tianyuBlog@0.1.0 dev: `cross-env NODE_ENV=development node server.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the tianyuBlog@0.1.0 dev 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! D:\work\nodejs\node_cache\_logs\2019-01-09T03_13_52_162Z-debug.log
解决:
这个报错是webpack依赖重复引入导致的,由于已经有依赖中引入的webpack,然后有自己引入的webpack。
下面是生产的依赖,将
“webpack”: “^4.0.0-beta.3”,
“webpack-dev-server”: “2.7.1”,
“webpack-manifest-plugin”: “1.2.1”,
删掉,移除node_modules。重新npm install 。再启动项目,就搞定了
"dependencies": { "@zeit/next-css": "^1.0.1", "@zeit/next-less": "^1.0.1", "antd": "^3.11.0", "autoprefixer": "7.1.2", "axios": "^0.16.2", "babel-cli": "^6.26.0", "babel-core": "6.25.0", "babel-eslint": "7.2.3", "babel-jest": "20.0.3", "babel-loader": "7.1.1", "babel-plugin-import": "^1.6.2", "babel-preset-react-app": "^3.0.2", "babel-runtime": "6.26.0", "browser-cookies": "^1.2.0", "case-sensitive-paths-webpack-plugin": "2.1.1", "chalk": "1.1.3", "compression": "^1.7.3", "css-loader": "^0.28.4", "dotenv": "4.0.0", "enquire-js": "^0.2.1", "eslint": "4.4.1", "eslint-config-react-app": "^2.0.0", "eslint-loader": "1.9.0", "eslint-plugin-flowtype": "2.35.0", "eslint-plugin-import": "2.7.0", "eslint-plugin-jsx-a11y": "5.1.1", "eslint-plugin-react": "7.1.0", "express": "^4.16.4", "extract-text-webpack-plugin": "3.0.0", "file-loader": "0.11.2", "fs-extra": "3.0.1", "highlight.js": "^9.13.1", "html-webpack-plugin": "2.29.0", "jest": "20.0.4", "less": "^3.9.0", "markdown-navbar": "^1.0.7", "marked": "^0.5.2", "moment": "^2.22.2", "next": "^7.0.2", "nprogress": "^0.2.0", "object-assign": "4.1.1", "postcss-flexbugs-fixes": "3.2.0", "postcss-loader": "2.0.6", "prismjs": "^1.15.0", "promise": "8.0.1", "prop-types": "^15.6.0", "rc-tween-one": "^2.2.19", "react": "^16.0.0-rc.2", "react-dev-utils": "^4.0.1", "react-dom": "^16.0.0-rc.2", "react-html-parser": "^2.0.2", "react-markdown": "^4.0.4", "react-redux": "^5.0.6", "react-router-dom": "^4.2.2", "redux": "^3.7.2", "redux-thunk": "^2.2.0", "style-loader": "0.18.2", "sw-precache-webpack-plugin": "0.11.4", "url-loader": "0.5.9", "utility": "^1.13.1", "webpack": "^4.0.0-beta.3", "webpack-dev-server": "2.7.1", "webpack-manifest-plugin": "1.2.1", "whatwg-fetch": "2.0.3", "yt-simplemde-editor": "^1.0.1" },
相关文章推荐
- 【datatable】Cannot read property 'style' of undefined问题解决
- 解决vue2.0路由 TypeError: Cannot read property 'matched' of undefined 的错误问题
- CANNOT READ PROPERTY ‘opera’ OF UNDEFINED解决方法
- easyui防止重复提交及进度条报错解决: Cannot read property 'onClose' of undefined
- 浏览器报错 Uncaught TypeError: Cannot read property 'prototype' of undefined 的解决办法
- Vue2.0 之 vue Cannot read property '__ob__' of undefined 异常(back报错)
- vuejs路由使用的问题Error in render function: "TypeError: Cannot read property 'matched' of undefined"
- cannot read property 'shape' of undefined
- extjs:Cannot read property 'processed' of undefined
- Cannot read property 'queueData' of undefined
- uploadify的JS组件报错:Uncaught TypeError: Cannot read property 'queueData' of undefined
- jquery file upload 报错:Cannot read property 'fileupload' of undefined
- Vue-router cannot read property _c of undefined
- aes.js:77 Uncaught TypeError: Cannot read property 'extend' of undefined(…)
- 修改样式表时在某些浏览器(如360)下遇到Cannot read property 'style' of undefined错误的解决方案
- TypeError: Cannot read property 'url' of undefined
- stylus compiling bug "Cannot read property 'nodes' of undefined"
- Uncaught TypeError: Cannot read property 'length' of undefined
- Uncaught TypeError: Cannot read property 'substring' of undefined
- [jQuery] Cannot read property ‘msie’ of undefined jQuery 1.9不支持 $.browser