Home > database >  React acting weird (compiled with problems 9 errors)
React acting weird (compiled with problems 9 errors)

Time:06-29

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'

CodePudding user response:

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.

CodePudding user response:

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

  • Related