React acting weird (compiled with problems 9 errors) - reactjs

I've been working with react using mern stack. Everything was fine until I used JSON.parse in a function when getting data out of the mongo database. I clicked save and I got 9 errors. I removed all the code, everything relating to it as if I never attempted it and I'm still getting these 9 errors shown below:
Any pointers?
Compiled with problems:X
ERROR in ./node_modules/cookie-signature/index.js 4:13-30
Module not found: Error: Can't resolve 'crypto' in '/Users/sebastianrichards/ReactProject/client/node_modules/cookie-signature'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/destroy/index.js 15:17-41
Module not found: Error: Can't resolve 'fs' in '/Users/sebastianrichards/ReactProject/client/node_modules/destroy'
ERROR in ./node_modules/destroy/index.js 19:11-26
Module not found: Error: Can't resolve 'zlib' in '/Users/sebastianrichards/ReactProject/client/node_modules/destroy'
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: { "zlib": require.resolve("browserify-zlib") }'
- install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "zlib": false }
ERROR in ./node_modules/etag/index.js 18:13-30
Module not found: Error: Can't resolve 'crypto' in '/Users/sebastianrichards/ReactProject/client/node_modules/etag'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/etag/index.js 20:12-31
Module not found: Error: Can't resolve 'fs' in '/Users/sebastianrichards/ReactProject/client/node_modules/etag'
ERROR in ./node_modules/express/lib/response.js 25:11-26
Module not found: Error: Can't resolve 'http' in '/Users/sebastianrichards/ReactProject/client/node_modules/express/lib'
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: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
ERROR in ./node_modules/express/lib/utils.js 31:18-40
Module not found: Error: Can't resolve 'querystring' in '/Users/sebastianrichards/ReactProject/client/node_modules/express/lib'
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 }
ERROR in ./node_modules/mime/mime.js 3:9-22
Module not found: Error: Can't resolve 'fs' in '/Users/sebastianrichards/ReactProject/client/node_modules/mime'
ERROR in ./node_modules/send/index.js 29:9-22
Module not found: Error: Can't resolve 'fs' in '/Users/sebastianrichards/ReactProject/client/node_modules/send'

Try doing a clean install of npm by deleting /node_modules and running npm install. Also check that the package in the error exists within your package.json.

I solved it, I removed import { json } from 'express/lib/response'; from the imports on one of the react files and it worked

Related

I am getting this error after installing jsonwebtokens in my react application

enter image description here
this is the error i am getting in the console!
There is no other error i am receiving and i am clueless about where should i look at to resolve this error
Edit1:
I just realized that I am getting this error when i import anything from jsonwebtoken for example:
import jwt from 'jsonwebtoken'
I also get these 3 error messages in my terminal:
ERROR in ./node_modules/jsonwebtoken/sign.js 18:4-21
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\pc user\Desktop\PokerSocketio\client\node_modules\jsonwebtoken'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/jsonwebtoken/verify.js 13:4-21
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\pc user\Desktop\PokerSocketio\client\node_modules\jsonwebtoken'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/jwa/index.js 3:13-30
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\pc user\Desktop\PokerSocketio\client\node_modules\jwa'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
webpack compiled with 3 errors

Unable to polyfill node modules webpack 5

I get several of the following errors for various packages when I run 'npm start'
Compiled with problems:
ERROR in ./node_modules/gaxios/build/src/gaxios.js 27:16-32
Module not found: Error: Can't resolve 'https' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\gaxios\build\src'
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: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
I've multiple fixes discussed here including downgrading react-scripts to version 4 (which breaks my site), setting empty module fallbacks, and trying to use the node-polyfill-webpack-plugin but none have worked.
Here is my webpack.config.js file:
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
module.exports = {
webpack: {
configure: {
resolve: {
fallback: {
fs: false,
tls: false,
net: false,
path: false,
zlib: false,
http: false,
https: false,
stream: false,
crypto: false,
},
},
},
},
plugins: [new NodePolyfillPlugin()],
};
Any help would be much appreciated.
Here is the full error:
Compiled with problems:
ERROR in ./node_modules/gaxios/build/src/gaxios.js 27:16-32
Module not found: Error: Can't resolve 'https' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\gaxios\build\src'
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: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js 20:24-48
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js 22:11-24
Module not found: Error: Can't resolve 'fs' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js 26:11-24
Module not found: Error: Can't resolve 'os' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\google-auth-library\build\src\auth'
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: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js 28:13-28
Module not found: Error: Can't resolve 'path' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\google-auth-library\build\src\auth'
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: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
ERROR in ./node_modules/google-auth-library/build/src/auth/oauth2client.js 22:15-32
Module not found: Error: Can't resolve 'stream' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\google-auth-library\build\src\auth'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
ERROR in ./node_modules/google-auth-library/build/src/crypto/node/crypto.js 20:15-32
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\google-auth-library\build\src\crypto\node'
Did you mean './crypto'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/google-p12-pem/build/src/index.js 14:11-24
Module not found: Error: Can't resolve 'fs' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\google-p12-pem\build\src'
ERROR in ./node_modules/gtoken/build/src/index.js 14:11-24
Module not found: Error: Can't resolve 'fs' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\gtoken\build\src'
ERROR in ./node_modules/gtoken/build/src/index.js 20:13-28
Module not found: Error: Can't resolve 'path' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\gtoken\build\src'
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: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
ERROR in ./node_modules/https-proxy-agent/dist/agent.js 45:30-44
Module not found: Error: Can't resolve 'net' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\https-proxy-agent\dist'
ERROR in ./node_modules/https-proxy-agent/dist/agent.js 47:30-44
Module not found: Error: Can't resolve 'tls' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\https-proxy-agent\dist'
ERROR in ./node_modules/jwa/index.js 5:13-30
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\jwa'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/jws/lib/data-stream.js 4:13-30
Module not found: Error: Can't resolve 'stream' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\jws\lib'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
ERROR in ./node_modules/jws/lib/sign-stream.js 8:13-30
Module not found: Error: Can't resolve 'stream' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\jws\lib'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
ERROR in ./node_modules/jws/lib/verify-stream.js 8:13-30
Module not found: Error: Can't resolve 'stream' in 'C:\Users\TheBlitzingBolt\Desktop\mcna-awards-website\node_modules\jws\lib'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }

How to create React App including Web3 using create-react-app? I am getting Module not found Error. BREAKING CHANGE: webpack < 5 used

I am new to Web3 and I am trying to create a react app integrated with web3. Below are the steps I followed in Ubuntu.
create-react-app app_name
cd app_name
npm i --save web3
npm start
and everything worked fine, I got the react app home page.
Now, as soon as I put the following line of code in the App.js the app breaks and I get the following long error. (See below, row 5)
import Web3 from "web3";
The error I get is as follows.
Compiled with problems:X
ERROR in ./node_modules/cipher-base/index.js 3:16-43
Module not found: Error: Can't resolve 'stream' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/cipher-base'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
Module not found: Error: Can't resolve 'crypto' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/eth-lib/lib'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/account.js 71:31-48
Module not found: Error: Can't resolve 'assert' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/ethereumjs-util/dist.browser'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/address.js 14:31-48
Module not found: Error: Can't resolve 'assert' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/ethereumjs-util/dist.browser'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/object.js 46:31-48
Module not found: Error: Can't resolve 'assert' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/ethereumjs-util/dist.browser'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
Module not found: Error: Can't resolve 'crypto' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/web3-eth-accounts/lib'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
Module not found: Error: Can't resolve 'crypto' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/web3-eth-accounts/node_modules/eth-lib/lib'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-providers-http/lib/index.js 30:11-26
Module not found: Error: Can't resolve 'http' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/web3-providers-http/lib'
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: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
ERROR in ./node_modules/web3-providers-http/lib/index.js 32:12-28
Module not found: Error: Can't resolve 'https' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/web3-providers-http/lib'
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: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
ERROR in ./node_modules/web3-providers-ws/lib/helpers.js 11:12-26
Module not found: Error: Can't resolve 'url' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/web3-providers-ws/lib'
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: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 37:11-26
Module not found: Error: Can't resolve 'http' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/xhr2-cookies/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: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 39:12-28
Module not found: Error: Can't resolve 'https' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/xhr2-cookies/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: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 41:9-22
Module not found: Error: Can't resolve 'os' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/xhr2-cookies/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: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 43:10-24
Module not found: Error: Can't resolve 'url' in '/home/gkv/Stuff/Tutorial/Projects/react/lottery-react-new/node_modules/xhr2-cookies/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: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
I tried multiple stackoverflow post but none of them seems to have proper solution.
Error Library web3 and Webpack in react and angular [closed]
Module not found: Error: Can't resolve 'stream' in 'C:\dev\jszip-test\node_modules\jszip\lib'
I am getting this error whilr importing Web3 from web3 in react js 17.0.1.how to fix this
If someone could help that would be great. I have been struggling with this for 5 days.
Web3 github page provides a solution here: https://github.com/ChainSafe/web3.js#web3-and-create-react-app
This solution takes advantage of react-app-rewired package: https://www.npmjs.com/package/react-app-rewired
Polyfills can be installed via node-polyfill-webpack-plugin: https://www.npmjs.com/package/node-polyfill-webpack-plugin
The benefits of this solution:
no need to eject and make modifications to config file --> react-scripts build will still work
no need to downgrade react-scripts to lower versions
Run npm install #web3-react/core web3 #web3-react/injected-connector after running npm uninstall web3 and deleting package-lock.json and node_modules
You DO NOT need to downgrade react or install any polyfill plugins for this
That is because Webpack 5 no longer does auto-polyfilling for node core modules.
Simply in order to modify the webpack.config.js in Create React App, you have to run
npm run eject
this will create a config directory and inside you will have webpack.config.js.
npm i node-polyfill-webpack-plugin
then inside webpack.config.js:
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin")
add this to plugins array
plugins: [
new NodePolyfillPlugin()
],
I explained how to set up with create-react-app here :
Web3 Issue : React Application not compiling
I also explained to solve with webpack:
Webpack breaking change

I am getting this error whilr importing Web3 from web3 in react js 17.0.1.how to fix this

Compiled with problems:X
ERROR in ./node_modules/cipher-base/index.js 3:16-43
Module not found: Error: Can't resolve 'stream' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\cipher-base'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\eth-lib\lib'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/account.js 71:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/address.js 14:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/object.js 46:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\web3-eth-accounts\lib'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\web3-eth-accounts\node_modules\eth-lib\lib'
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: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-providers-http/lib/index.js 30:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\web3-providers-http\lib'
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: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
ERROR in ./node_modules/web3-providers-http/lib/index.js 32:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\web3-providers-http\lib'
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: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 37:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\xhr2-cookies\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: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 39:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\xhr2-cookies\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: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 41:9-22
Module not found: Error: Can't resolve 'os' in 'C:\Users\bittu\OneDrive\Desktop\BChain\Bitjit_Token\client\node_modules\xhr2-cookies\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: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }

I am having issues importing react instagram in my project

I installed it using npm i react-instagram-embed. It however gave me an error when i tried importing it in my project using the command:
import InstagramEmbed from 'react-instagram-embed.
It return the error below
Module not found: Error: Can't resolve 'querystring' in '/home/marcos/Desktop/REACT/Instagram-clone/instagram/node_modules/react-instagram-embed/es'
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 }

Resources