-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REACTJS] Module not found: Error: Can't resolve 'process/browser' #2527
Comments
This seems to be a webpack 5 issue: https://github.com/webpack/changelog-v5#automatic-nodejs-polyfills-removed Searching for that specific error message revealed microsoft/PowerBI-visuals-tools#365 (comment) , which recommends adding a Can you test and see if that resolves the issue? If so we can update the docs |
To use the module in 0.18.1+ you will have to replace the import with import * as XLSX from 'xlsx'; Using that, we can't reproduce in a fresh project: $ npx create-react-app my-app
$ cd my-app
$ npm i --save xlsx
$ cat <<EOF >src/App.js
import './App.css';
import * as XLSX from 'xlsx'
function App() { return ( <div className="App">{XLSX.version}</div> ); }
export default App;
EOF
$ npm start You should see "0.18.2" (the version number embedded in the script) The terminal output shows
Any info to help reproduce the issue would be helpful, as it seems to affect other projects as well facebook/create-react-app#12072 |
Given the number of projects affected and issues reported to create-react-app, as seen in issues like facebook/create-react-app#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 |
The following worked for me. At this to your webpack.mix.js . mix.options({ |
I ran into this problem when trying to use this https://v4.mui.com/components/drawers/#swipeable I used this as a workaround https://www.npmjs.com/package/process |
I ran into the same issue but only in combination with the following line in my Webpack configuration: 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. |
@gvdhorst Update to the latest version of the library. 0.18.3 fully removed references to |
Worked for me as well :) |
0.18.3 removed What is |
Seems it's still not resolved on CRA 5.0.1 |
The latest version works in CRA 5.0.1 . https://docs.sheetjs.com/docs/getting-started/installation/frameworks more details on upgrading |
@SheetJSDev yes, I confirmed. Because it conflicts with my another fix for CRA 5.0.1. It works now |
Ran into the same issue on Mac M1 Pro (Ventura) and I was trying to integrate Kepler.gl into a react typescript project. Here is the version details for CRA, Webpack and React.
Followed the post by @SheetJSDev solved it by
more details on https://docs.sheetjs.com/docs/getting-started/installation/frameworks/ Thanks @SheetJSDev |
EDIT: this issue affects 0.18.1 and 0.18.2. Upgrade to the latest version if you are encountering this issue
config:
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.
The text was updated successfully, but these errors were encountered: