next.js: TypeError: Cannot read property 'tap' of undefined
Bug report
Describe the bug
yarn build :
Compiling client /Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/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 (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/webpack/lib/ProgressPlugin.js:205:32) at SyncHook.eval [as call] (eval at create (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:9:1) at SyncHook.lazyCompileHook (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/tapable/lib/Hook.js:154:20) at Compiler.newCompilation (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/next/node_modules/webpack/lib/Compiler.js:498:26) at hooks.beforeCompile.callAsync.err (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/next/node_modules/webpack/lib/Compiler.js:534:29) at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1) at AsyncSeriesHook.lazyCompileHook (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/tapable/lib/Hook.js:154:20) at Compiler.compile (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/next/node_modules/webpack/lib/Compiler.js:529:28) at readRecords.err (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/next/node_modules/webpack/lib/Compiler.js:268:11) at Array.inputFileSystem.stat.err (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/next/node_modules/webpack/lib/Compiler.js:401:20) at Storage.finished (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16) at provider (/Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9) at /Users/helabenkhalfallah/Desktop/github_workspace/news_kit_frontend/node_modules/graceful-fs/polyfills.js:282:31 at FSReqWrap.oncomplete (fs.js:170:21)
My project : https://github.com/helabenkhalfallah/news_kit_frontend
Thanks đ
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 26 (5 by maintainers)
Commits related to this issue
- Fix webpack compilation issue Downgrade webpack in order to solves the following issue: https://github.com/vercel/next.js/issues/5781 — committed to dxos/console by vitaliyworks 5 years ago
- Fix webpack compilation issue (#90) Downgrade webpack in order to solves the following issue: https://github.com/vercel/next.js/issues/5781 — committed to dxos/console by vitaliyworks 5 years ago
- Added table grid and mock registry client. (#89) * New data grid and selector. * Storybook error. * Fix storybook. * Update ConfigPanel.tsx * Fix webpack compilation issue (#90) Downgr... — committed to dxos/console by richburdon 5 years ago
Try removing âwebpackâ from package.json, remove package-lock.json and node_modules directory. Then reinstall the packages with
npm installThis error occurred when I tried to use Next
7.0.2with Webpack4.27.1I had to downgrade webpack version to
4.20.2for this error to go away.install html-webpack-plugin@4 instead.
@renjithgr Thatâs because Next 7.0.2 is powered by Webpack
4.20.2under the hood.If youâre going to use Webpack in addition to other libraries that use Webpack as a dependency, it is probably a good idea to be consistent (like with Storybook).
I.e. some package.json
Upgrade to major/minor versions wisely.
I get this error when I run npm run dev. Can anyone help me fix this bug, please
At first I was having this issue https://github.com/webpack/webpack/issues/2131. After adding webpack as a dependency I started getting this problem.
Trying to narrow it down further;
.lessimport fromAntDworked (the only file using a less compile step).webpack@4.4.2also worked.10.0.1(without specifying any webpack dependency) also solved them problem.A while back I also tried to create a minimal reproducible example repository to demonstrate in which commit it was breaking, but it was actually rather hard to reproduce it:
I found that changing from 10.0.1 to 10.0.2-canary-1 made it break and going back to 10.0.1 fixed it again. However I was not able to reproduce it in a new project. Since cleaning node_modules and removing package.lock or yarn.lock seems to help many people, I believe it might be an issue with the dependency graph.
Anyone else experiencing this with
AntDor with@zeit/next-lessspecifically?Hope this helps someone. đ
@Imprasna I got this exact error, and had to downgrade to webpack@4.4.2 to stop it
info - Using external babel configuration from C:.âŚ\Nextjs\vurox-dark\vurox-dark-master.babelrc error - ./public/style/styles.less TypeError: Cannot read property âtapâ of undefined
//solution
move webpack from devDependencies to dependency change the version of next and webpack to ânextâ: â10.0.1â, âwebpackâ: â4.42.1â,
I had the same problem, but my
package.jsondidnât have Webpack đ¤ Then I installed it and removed. Now everything works again:Iâve also run into
Cannot read property 'tap' of undefined.I need to install webpack for react-styleguidist, but it seems if the version doesnât match the one Next is using this error occurs. I solved this by specifically installing the same webpack version Next requires.
If you use Yarn you might be able to solve this with its selective dependency resolutions, but havenât tried that myself.
Sure, hereâs a working example that I use across some of my apps. https://github.com/webbertakken/simple-react-app.
I hate webpack, im trying to deploy my app to heroku and isnt working, locally it does work , when i remove all node_modules, and install packages and then webpack@4.1.1 , but in heroku it doesnt it always give same error
Error: Cannot find module âwebpack/lib/RequestShortenerâ
error also on Now, zeit, idk where to deploy my application, i think i will have to use my application static and make it a way to load dynamic posts.
Sometimes npm install doesnât install firebase so you have to do yarn install.
I solved by removing node_modules, removing any reference to webpack, restarting the computer and running npm i (note that without the restart, it didnât work). This is not an easy bug to fix it seems
Try deleting your node_modules and package-lock.json file and do
npm installagain. I get tap errors when switching back and forth between modules with different dependency versions of webpack. Something isnât getting cleaned up right with npm.