Next.js Discord

Discord Forum

Hitting weird error when trying to create component package

Unanswered
Himalayan posted this in #help-forum
Open in Discord
HimalayanOP
I'm trying to create a separate npm component package for components that are common to multiple projects.

I've created the package, published it and imported it into the consuming projects. But when I start the apps for the consuming projects, I see this:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/chuck/my-project/node_modules/next/image' imported from /home/chuck/my-project/node_modules/@myscope/shared-components/lib/index.esm.js
Did you mean to import next/image.js?

After a lot of research I found that some folks recommend not trying to create external packages that use next/link or next/image, so I've removed the components that use those, but I'm still seeing the error.

I'm out of ideas, I've checked that referenced paths exist. Can anyone help please?!

0 Replies