[error] Cannot find module "pinia/dist/pinia.mjs"

I’m having a build problem with NUXT3+Pinia, locally I can get it to run fine but when deploying on Netlify I keep getting this error:

[error] Cannot find module “pinia/dist/pinia.mjs”

Doing some research there are some work arounds when installing the module (basically forcing the module) but I’m not sure how to replicate that on the deployment process.

If anyone has had any luck with this combo would love to hear how you resolved it!

Hey @chebyrashka,

Mostly there’s a difference between a dev script and a build script, so did you try the build script locally?

Without seeing your repo or package.json file, I suspect you have pinia installed in your package.json, in devDependencies and not dependencies.

Linking your public repo would come in handy. :smiley:



I was able to get it going, I had a few issues that were causing problems but in the end switching to pnpm did the trick.

And yeah, the original route I was looking at was the hacky version that I got working locally so I was trying to replicate this on Netlify, but this way is much cleaner.

1 Like