gatsby: Upgrading to v2 - Cannot find module 'webpack/lib/removeAndDo'
-
I followed the v1 to v2 doc
-
removed the
node-modulesfolder and thepackage-lock.jsonfile -
ran
npm cache verifythennpm installand finallygatsby develop -
and now getting the following error:
error UNHANDLED EXCEPTION
Error: Cannot find module 'webpack/lib/removeAndDo'
- v8-compile-cache.js:159 require
[kaizen-2018]/[v8-compile-cache]/v8-compile-cache.js:159:20
- ExtractedModule.js:30 Object.<anonymous>
[kaizen-2018]/[extract-text-webpack-plugin]/ExtractedModule.js:30:42
- v8-compile-cache.js:178 Module._compile
[kaizen-2018]/[v8-compile-cache]/v8-compile-cache.js:178:30
- v8-compile-cache.js:159 require
[kaizen-2018]/[v8-compile-cache]/v8-compile-cache.js:159:20
- index.js:7 Object.<anonymous>
[kaizen-2018]/[extract-text-webpack-plugin]/index.js:7:23
- v8-compile-cache.js:178 Module._compile
[kaizen-2018]/[v8-compile-cache]/v8-compile-cache.js:178:30
- v8-compile-cache.js:159 require
[kaizen-2018]/[v8-compile-cache]/v8-compile-cache.js:159:20
- index.js:3 Object.<anonymous>
[kaizen-2018]/[gatsby-1-config-extract-plugin]/index.js:3:33
- v8-compile-cache.js:178 Module._compile
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 29 (12 by maintainers)
Try bumping all your
"gatsby-x"dependencies to versionnext, the same asgatsbyandgatsby-image. Note that you’ll need to install extra dependencies for some plugins. See https://v2--gatsbyjs.netlify.com/docs/migrating-from-v1-to-v2/#manually-install-plugins-peer-dependencies@DSchau,
I just updated from gatsby 2.19.32 to 2.20.21, and suddenly I wasn’t able to run
gatsby develop. It would error out immediately with “cannot find module webpack”.I updated all my gatsby-x packages, deleted package-lock and node_modules, then ran
npm install, but I still kept getting the same error. Finally, I just went ahead and installed webpack (which I had never needed before) as a dev dependency, and voila, it worked.My question is, why did I suddenly start needing webpack after just a minor update of Gatsby?
I’m still getting this error
Cannot find module 'webpack/lib/removeAndDo'withgatsby-plugin-netlify-cms@next.Before adding
yarn add extract-text-webpack-plugin@^1.0.1I got an error stating thatCannot find module 'extract-text-webpack-plugin'.I tried removing yarn.lock and node_modules with no luck.
Looks like the netlify-cms plugin has an update for v2 but it doesn’t seem to work. Is it related this issue or should I create a new issue?
I believe Gatsby 2 has removed postcss plugins for now. So the plugin
gatsby-plugin-postcss-sassis not compatible with Gatsby 2. Currently you can use https://next.gatsbyjs.org/docs/add-custom-webpack-config to define your webpack config to use postcss plugins. More info: https://github.com/gatsbyjs/gatsby/issues/5778#issuecomment-395711865^ I upgraded from 1.9 (I know) to the latest version and had this problem until I installed
webpacklike @devuxer.@anantoghosh Yeah, I just checked
gatsby-plugin-postcss-sasspage and saw an empty page 😃. Remove this plugin also fixed the issue.Why are unsupported plugins not listed in the migration documentation? (or supported ones are listed here).
But I got another issue, I moved
layout.jsto thecomponentsfolder, so I movedindex.csstoo and now the site loses all styling 😃