-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Multiple errors Module not found: Error: Can't resolve path, buffer, stream during upgrade to react-scripts 5.0.0 #12072
Comments
with same problem |
some problem here |
Webpack 5 has a bunch of breaking changes, as with any major release. One of these changes is described by that error message:
So you must do as the error messages says and both configure webpack to use a polyfill for each node core module (it suggests the polyfill webpack 4 uses), and install the polyfill. Of course, you can't change the The best option here is for CRA to support you extending the webpack config, for so many reasons, but the probable best option (again, for CRA) is to add every polyfill and configure them all to be used, to support all the existing NPM packages. |
I'm using react-app-rewired temporarily, hoping this gets sorted out. Allows extension of webpack.config without ejecting.
config.overrides.js module.exports = function override (config, env) {
config.resolve.fallback = Object.assign(config.resolve.fallback || {}, {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
assert: require.resolve('assert'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify'),
url: require.resolve('url')
})
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
})
])
return config
} |
What is the correct fix to this? Should it happen here or should it be a change to webpack such as adding a flag to enable the previous behavior? If the change was going to be to cra one option for the fallbacks would be to have the webpack config look at the installed modules and add the fallbacks as needed. If no one is working on this I am willing to put some time into fixing this, but I personally don't know which would be the best approach. |
I am also facing the same issue. Any suggestions on the best way to resolve this? |
Using react-app-rewired works well as mentioned above works well. Before I started doing that I was using patch package to patch the webpack config. Ejecting is also an option, but I have avoided doing this personally. |
Thank you. I am using |
I was running into this exact issue too. I finally figured it out. My app was using the popular npm package If you're not using the |
@james-ingold Using react-app rewired is really messy and you end up installing a ton of dependencies you do not need as well as receiving various errors such as |
I have the same problem |
same problem here |
Same problem on my end. |
Same problem |
Same issue here |
Same problem here |
same problem on my end If you get solution please let me know. |
I am using react 17.0.2 with npm 7.14.0 and node 14.18.2 and try to upgrade to react-scripts 5.0.0.
I am using shpjs content-disposition jszip safe-buffer etc
When I run npm start after upgrading to react-scripts 5.0.0 I get:
When using react-scripts 4.0.3 I was getting no errors at all.
To resolve these errors I installed each of the above-mentioned packages individually although I do not find the reason to install external dependencies in my project that are being used from the packages I use, I mean they should be alreay available there, created a webpack.config.js and included there:
as I did not care including pollyfils and supporting old browsers.
I also tried this in case I wanted to support them.
I removed package-lock.json and node_modules hit npm i, npm start and I got this:
have tried all the possible solutions that can be found on the net but with no luck including this thread and this one
I have also installed process library and declare it in the webpack. Still the same error. How do I resolve this? Any recommendations are welcome.
Stackoverflow link: https://stackoverflow.com/questions/71144674/referenceerror-process-is-not-defined-at-object-node-modules-path-path-js-bu
The text was updated successfully, but these errors were encountered: