[REACTJS] Module not found: Error: Can't resolve 'process/browser'
See original GitHub issueEDIT: this issue affects 0.18.1 and 0.18.2. Upgrade to the latest version if you are encountering this issue
config:
"react": "^17.0.2",
"xlsx": "^0.18.2",
"react-scripts": "5.0.0",
with latest webpack version
the following shows up as the error with npm start. XLSX is imported into a react component via import XLSX from ‘xlsx’; switched to xlsx: 0.17.4 and the error seems to go away.
Module not found: Error: Can't resolve 'process/browser' in '/Users/0xsaurav/code/wiseid/wiseid-snbx/node_modules/xlsx'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Error: Can't resolve 'process/browser' #365 - GitHub
When using 3.1.19 I'm getting the following error: ERROR Failed to compile with 1 errors 11:17:18 error in .
Read more >Webpack 5 - Uncaught ReferenceError: process is not defined
Try to use frontend-compatible modules whenever possible. It's possible to manually add a polyfill for a node.js core module. An error message ...
Read more >Module not found: Error can't resolve in react - YouTube
The following issues are handled:1. Module not found : Error can't resolve 'child_process'2. Uncaught ReferenceError: the process is not ...
Read more >Resolve | webpack
Resolve. These options change how modules are resolved. Webpack provides reasonable defaults, but it is possible to change the resolving in detail.
Read more >Webpack 5 Issues | Documentation - Web3Auth
This issue is caused due to the fact that the web3.js and ethers.js packages have certain dependencies, which are not present within the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I ran into the same issue but only in combination with the following line in my Webpack configuration:
plugins: [new webpack.ProvidePlugin({ process: 'process/browser' })]Removing this line from my Webpack configuration allowed me to import the xlsx module, but stopped me from importing the avsc module I also use. So it’s not a good solution for me, but it might explain why other people are seeing this error.
Given the number of projects affected and issues reported to create-react-app, as seen in issues like https://github.com/facebook/create-react-app/issues/11756, this is almost certainly something that needs to be resolved in create-react-app. A number of workarounds have been presented in that thread, from ejecting to
@craco/craco. While waiting for a fix, please try one of the workarounds and report back with results.