payal_harwani
payal_harwani

Reputation: 121

Getting the error "Module not found: Error: Can't resolve 'querystring'", how do I fix this?

After installing react-instagram-embed package I got this error and tried all possible solution but still not working!!! Anyone knows solution for this??

Module not found: Error: Can't resolve 'querystring' in 'C:\Users\vytck\Desktop\ibm\node_modules\finnhub\dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

  • add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
  • install 'querystring-es3' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "querystring": false }

Upvotes: 11

Views: 37024

Answers (2)

guaobai
guaobai

Reputation: 1

querystring can be directly introduced using 'qs' in the new version of node

import qs from 'qs'

Upvotes: -1

Nwawel A Iroume
Nwawel A Iroume

Reputation: 1369

querystring is deprecated since at least since last Node LTS version 14.

So if you want to keep your current version of react-instagram-embed

install querystring-es3

yarn add querystring-es3 or npm i querystring-es3

in your webpack.config.js configuration file update or add the resolve entry to look like this

resolve: {
   fallback: { "querystring": require.resolve("querystring-es3") }
}

Upvotes: 10

Related Questions