Pinia not working
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v16.16.0
- Nuxt Version:
3.0.0-rc.8
- Package Manager:
npm@8.11.0
- Builder:
vite
- User Config:
modules
,buildModules
,colorMode
,typescript
,experimental
,vite
- Runtime Modules:
@nuxtjs/tailwindcss@5.3.2
,@nuxtjs/color-mode@3.1.4
,@vueuse/nuxt@9.1.0
- Build Modules:
@pinia/nuxt@0.4.0
Reproduction
I installed the pinia, added it to buildModule and got an error when starting nuxt. It worked fine on the RC 6.
Describe the bug
ERROR Cannot start nuxt: Cannot find module 'pinia/dist/pinia.mjs' 10:34:41
Require stack:
- /home/nuxt3/index.js
Require stack:
- index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at Function._resolve [as resolve] (node_modules/jiti/dist/jiti.js:1:108181)
at resolveModule (node_modules/@pinia/nuxt/node_modules/@nuxt/kit/dist/index.mjs:276:29)
at setup (node_modules/@pinia/nuxt/dist/module.mjs:22:32)
at Object.normalizedModule (node_modules/@pinia/nuxt/node_modules/@nuxt/kit/dist/index.mjs:607:29)
at async installModule (node_modules/@nuxt/kit/dist/index.mjs:448:3)
at async initNuxt (node_modules/nuxt/dist/index.mjs:1495:7)
at async load (node_modules/nuxi/dist/chunks/dev.mjs:6768:9)
at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6813:5)
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:7
- Comments:77 (9 by maintainers)
Top Results From Across the Web
vue.js - Vuejs 3 Pinia not working, Cannot read properties of ...
I try to use Pinia but it never works ...
Read more >Vue Pinia not working - StackBlitz
the [script setup docs](https://v3.vuejs.org/. api/sfc-script-setup.html#sfc-script-setup). to learn more. ## Recommended IDE Setup.
Read more >Introduction - Pinia
I tested out ideas based on my experience developing applications, reading other people's code, working for clients who use Pinia, and answering questions...
Read more >Pinia not installed? : r/vuejs - Reddit
The most common reason this error happens is when you are calling pinia before Vue initiates it.
Read more >Vue 3: Support Pinia store : WEB-52890 - YouTrack
Yeah, this really is a bummer. Nothing works with pinia and webstorm within the SFC Template. It seems not a type script problem...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After running
npm install pinia @pinia/nuxt --legacy-peer-deps
I removed pinia withnpm uninstall pinia
and for some reason it is working great like magic 🧙♂️Here’s what worked for me:
@pinia/nuxt
with npm or yarnnuxt.config.ts
file: