Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'tap' of undefined #5781

Closed
helabenkhalfallah opened this issue Nov 30, 2018 · 26 comments
Closed

TypeError: Cannot read property 'tap' of undefined #5781

helabenkhalfallah opened this issue Nov 30, 2018 · 26 comments

Comments

@helabenkhalfallah
Copy link

helabenkhalfallah commented Nov 30, 2018

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 :)

@timneutkens
Copy link
Member

Not sure what to do with this, it sounds like you're on an old version of webpack or something.

@Enalmada
Copy link
Contributor

Try deleting your node_modules and package-lock.json file and do npm install again. 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.

@mahadazad
Copy link

Try removing "webpack" from package.json, remove package-lock.json and node_modules directory. Then reinstall the packages with npm install

@ghost
Copy link

ghost commented Dec 7, 2018

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 [email protected] , 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.

@cellog
Copy link

cellog commented Jan 2, 2019

I removed all references to webpack from package.json, rm -rf node_modules package-lock.json and npm i, and still get this error. Next 7.0.2

@novascreen
Copy link
Contributor

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.

@cellog
Copy link

cellog commented Jan 4, 2019

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

@renjithgr
Copy link

This error occurred when I tried to use Next 7.0.2 with Webpack 4.27.1

I had to downgrade webpack version to 4.20.2 for this error to go away.

@leotm
Copy link

leotm commented Mar 21, 2019

@renjithgr That's because Next 7.0.2 is powered by Webpack 4.20.2 under 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

    "next": "7.0.2",
    "webpack": "4.20.2",

Upgrade to major/minor versions wisely.

@edo92
Copy link

edo92 commented Aug 11, 2019

Sometimes npm install doesn't install firebase so you have to do yarn install.

@nagata123 nagata123 mentioned this issue Nov 1, 2020
@Imprasna
Copy link

Imprasna commented Dec 3, 2020

I get this error when I run npm run dev. Can anyone help me fix this bug, please
Screenshot from 2020-12-03 10-00-24

@amnollski
Copy link

@Imprasna I got this exact error, and had to downgrade to [email protected] to stop it

@arturyumaev
Copy link

Try removing "webpack" from package.json, remove package-lock.json and node_modules directory. Then reinstall the packages with npm install

Worked for me, thank you!

@webbertakken
Copy link

At first I was having this issue webpack/webpack#2131.
After adding webpack as a dependency I started getting this problem.

Trying to narrow it down further;

  • Commenting out a .less import from AntD worked (the only file using a less compile step).
  • Downgrading to [email protected] also worked.
  • Downgrading to next 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 AntD or with @zeit/next-less specifically?

Hope this helps someone. 😄

@wi-ski
Copy link

wi-ski commented Mar 25, 2021

@webbertakken - Yep, thats why im here. Ty for your comment <3

@wi-ski
Copy link

wi-ski commented Mar 25, 2021

This helped me: #21679 (comment)

@coderaudi
Copy link

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

  1. delete package-lock.json
  2. delete .next folder
  3. open package.json
    move webpack from devDependencies to dependency
    change the version of next and webpack to
    "next": "10.0.1",
    "webpack": "4.42.1"
    ,
  4. npm i
  5. run the project ! good Luck

@kanonochina
Copy link

use version 4 npm i --save-dev html-webpack-plugin@4

@ChuckJonas
Copy link

@webbertakken could you share more information on your base configuration? I'm trying to just start with the next antd example and running into these same issues

@webbertakken
Copy link

@webbertakken could you share more information on your base configuration? I'm trying to just start with the next antd example and running into these same issues

Sure, here's a working example that I use across some of my apps. https://github.com/webbertakken/simple-react-app.

@lixingyang-lxy
Copy link

Try removing "webpack" from package.json, remove package-lock.json and node_modules directory. Then reinstall the packages with npm install

not effect, why ??? below is my setup
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"html-webpack-plugin": "^5.3.1",
"webpack": "^4.1.1",
"webpack-cli": "^3.0.4"
},

@zoozalp
Copy link

zoozalp commented Jun 3, 2021

install html-webpack-plugin@4 instead.

npm uninstall --save html-webpack-plugin
npm install --save-dev html-webpack-plugin@4

@chimit
Copy link
Contributor

chimit commented Jun 8, 2021

I had the same problem, but my package.json didn't have Webpack 🤔 Then I installed it and removed. Now everything works again:

npm install --save-dev [email protected]
npm run dev
npm uninstall webpack

@matinkaboli
Copy link

I had the same problem, but my package.json didn't have Webpack thinking Then I installed it and removed. Now everything works again:

npm install --save-dev [email protected]
npm run dev
npm uninstall --save-dev [email protected]

Thanks, it worked for me.

vitaliyworks added a commit to dxos/console that referenced this issue Aug 26, 2021
Downgrade webpack in order to solves the following issue:
vercel/next.js#5781
wachulski pushed a commit to dxos/console that referenced this issue Aug 26, 2021
Downgrade webpack in order to solves the following issue:
vercel/next.js#5781
wachulski pushed a commit to dxos/console that referenced this issue Aug 26, 2021
* New data grid and selector.

* Storybook error.

* Fix storybook.

* Update ConfigPanel.tsx

* Fix webpack compilation issue (#90)

Downgrade webpack in order to solves the following issue:
vercel/next.js#5781

Co-authored-by: Vitaliy <[email protected]>
@ozanservet
Copy link

Try removing "webpack" from package.json, remove package-lock.json and node_modules directory. Then reinstall the packages with npm install

just deleting node_module using npx rimraf ./node_modules and recreating with npm i worked for me. If you delete package.json, npm i cannot find which packages to install.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Feb 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests