您的位置:首页 > 运维架构

解决: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"
},
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐