6 Replies
I'v tried this solution , adding an alias to my config... but this didn't work
Stack Overflow
Cannot find module 'pinia/dist/pinia.mjs' when using run dev
I setup Pinia on top of fresh Nuxt3 app and start dev server, with exactly these commands in order:
npx nuxi init nuxt-app
cd nuxt-app
npm install
npm install @pinia/nuxt
npm run dev
Dev server runs
I tried running
npm i pinia -f
but it seemed to have broke some stuff and did not work correctly etitherEnsure you’ve installed both
pinia
and @pinia/nuxt
, added @pinia/nuxt
module in nuxt config, and executed npx nuxi prepare
You do not need the pinia alias.Why is it necessary to download pinia separately when using the nuxt module for it? Isn't that the point of the modules, to buddle dependencies? @cuebit
Because typescript doesn’t know Pinia exists since it’s a sub dependency. It’s not needed if you’re just using it out of the the box, but it’s require for module resolution when importing from the module directly.