I set up Pinia on top of a new Nuxt3 application and started the development server, using the following commands in sequence:
npx nuxi init nuxt-app cd nuxt-app npm install npm install @pinia/nuxt npm run dev
The development server runs without any problems. Then I put this line of code into "nuxt.config.ts";
export default defineNuxtConfig({ modules: ["@pinia/nuxt"], });
And, when I tried to connect to the development server again, it gave this error message in the terminal:
ERROR Cannot start nuxt: Cannot find module 'pinia/dist/pinia.mjs' 12:03:55 Require stack: - C:UsersuserDocumentsgithub2nuxt-appindex.js
As far as I know, this is a bug and will be fixed someday. Until then you can put
In your
nuxt.config.ts
it will work.Found from About Pinia’s VueSchool course .
As mentioned here, there is a problem with NPM not performing the operation, which works fine, and the solution is as follows: