I am trying to set up Nuxt3 to work with Pinia.
Steps Taken:
npm install @pinia/nuxtnpm install @pinia/nuxt --legacy-peer-deps, which worked fineimport { defineNuxtConfig } from 'nuxt'
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
meta: {
link: [
{
rel: "stylesheet",
href:"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
}
],
script: [
{ src: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js', integrity: 'sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2', crossorigin: 'anonymous' }
]
},
ssr: false,
buildModules: ['@pinia/nuxt'],
base: '/',
})
GET http://localhost:3000/_nuxt/@id/pinia/dist/pinia.mjs net::ERR_ABORTED 404 (Not Found)
I've been googling around, and can't figure out what's broken here... I tried taking out the 'base' argument in nuxt.config.ts, and that didn't help either. If I take out the pinia declaration everything works fine.
Resolved by running:
npm install pinia @pinia/nuxt @nuxtjs/composition-api --legacy-peer-deps
I guess I was missing the actual pinia library
In the Nuxt docs they suggest adding this to your package.json before running npm install:
"overrides": {
"vue": "latest"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With