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

Module not found error #19

Closed
JoeySpen opened this issue Feb 13, 2022 · 3 comments
Closed

Module not found error #19

JoeySpen opened this issue Feb 13, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JoeySpen
Copy link

Hi, I installed and am trying to use in my create-react-app but I'm getting this error. Any ideas?

Compiled with problems:

ERROR in ./node_modules/@solana/spl-name-service/dist/utils.js 14:33-50

Module not found: Error: Can't resolve 'asseCompiled with problems:

ERROR in ./node_modules/@solana/spl-name-service/dist/utils.js 14:33-50

Module not found: Error: Can't resolve 'assert' in '/media/joeyspen/Game Drive/learning/SolanaProject/node_modules/@solana/spl-name-service/dist'

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


ERROR in ./node_modules/@solana/spl-name-service/dist/utils.js 16:17-34

Module not found: Error: Can't resolve 'crypto' in '/media/joeyspen/Game Drive/learning/SolanaProject/node_modules/@solana/spl-name-service/dist'

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 }rt' in '/media/joeyspen/Game Drive/learning/SolanaProject/node_modules/@solana/spl-name-service/dist'

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


ERROR in ./node_modules/@solana/spl-name-service/dist/utils.js 16:17-34

Module not found: Error: Can't resolve 'crypto' in '/media/joeyspen/Game Drive/learning/SolanaProject/node_modules/@solana/spl-name-service/dist'

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 }
@jamland
Copy link
Member

jamland commented Feb 13, 2022

Hi 👋
Looks like create react app uses webpack 5 which have beeaking changes for some of used Solana modules.
The only quick fix would be to use Webpack 4. But Im not sure how to enable it with CRA.
I will check tomorrow if I can fix it and deploy update. Thank you for reporting!

@jamland jamland self-assigned this Feb 13, 2022
@jamland jamland added the bug Something isn't working label Feb 13, 2022
@jamland
Copy link
Member

jamland commented Feb 14, 2022

Similar issue on anza-xyz/wallet-adapter#241

For those who have such error with webpack follow advice in issue above using other tools than CRA and webpack 5.

One of the tool I made and use myself: React.JS/ Next.JS
https://github.com/thuglabs/create-dapp-solana-nextjs

@jamland
Copy link
Member

jamland commented Feb 17, 2022

update published.
check version >=0.10.2

@jamland jamland closed this as completed Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants