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

NextJS: Module not found: Can't resolve 'canvas' #785

Open
developer-sushant opened this issue Dec 31, 2023 · 2 comments
Open

NextJS: Module not found: Can't resolve 'canvas' #785

developer-sushant opened this issue Dec 31, 2023 · 2 comments

Comments

@developer-sushant
Copy link

I am trying to use react-konva in nextjs and getting an error:

./node_modules/konva/lib/index-node.js:4:15
Module not found: Can't resolve 'canvas'
Did you mean './canvas'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.

https://nextjs.org/docs/messages/module-not-found

@lavrton
Copy link
Member

lavrton commented Jan 2, 2024

@FranciscoAnghinoni
Copy link

Hey @developer-sushant,
I'm guessing you're having trouble getting Canvas to work on your Mac. I had the same problem!
You probably need to install Xcode and Homebrew first. I don't remember the exact steps, but I googled the error message on Google's AI website (ai.google.com) and found instructions. After using Homebrew to install some things, Canvas finally worked for me.
Hope this helps!

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

3 participants