Skip to content
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

Can'r resolve buffer #634

Open
EugeneApprentice opened this issue Jan 8, 2022 · 3 comments
Open

Can'r resolve buffer #634

EugeneApprentice opened this issue Jan 8, 2022 · 3 comments

Comments

@EugeneApprentice
Copy link

Just created a react app (CRA), imported xml2js, when compiling I do get this error

Compiled with problems:X

ERROR in ./node_modules/string_decoder/node_modules/safe-buffer/index.js 4:13-30

Module not found: Error: Can't resolve 'buffer' in '/Users/dev/projects/tmp/barebone-cra/node_modules/string_decoder/node_modules/safe-buffer'

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: { "buffer": require.resolve("buffer/") }'
	- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "buffer": false }


ERROR in ./node_modules/xml2js/lib/parser.js 38:17-47

Module not found: Error: Can't resolve 'timers' in '/Users/dev/projects/tmp/barebone-cra/node_modules/xml2js/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: { "timers": require.resolve("timers-browserify") }'
	- install 'timers-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "timers": false }

Any ideas how to bypass it?

Node: 16.13.1

@ctrlmaniac
Copy link

I'm having the same issue

@levos-snr
Copy link

have you tried
"browser": {
"buffer": false
}
in your package.json

@pedrobmarin
Copy link

I'm having a similar problem.
For now I'm sticking with https://github.com/facebook/create-react-app/releases/tag/v4.0.3 that does not include webpack 5. As far as I investigated it, looks like the problem goes deep into some dependency (sax, maybe?). I guess react-app users can also try to resolve with some 3rd party lib like craco.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants