500 Cannot find package '@vue/composition-api' imported from C:\Users\Aa\node_modules\vue-demi\lib\index.mjs

I have this error when just install pinia to nuxt 3


 ERROR  [nuxt] [request error] [unhandled] [500] Cannot find package '@vue/composition-api' imported from C:\Users\Aal-Naib\node_modules\vue-demi\lib\index.mjs
  at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
  at new NodeError (node:internal/errors:399:5)
  at packageResolve (node:internal/modules/esm/resolve:794:9)
  at moduleResolve (node:internal/modules/esm/resolve:843:20)
  at defaultResolve (node:internal/modules/esm/resolve:1070:11)
  at DefaultModuleLoader.resolve (node:internal/modules/esm/loader:306:12)
  at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:155:32)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:33)
  at link (node:internal/modules/esm/module_job:75:36)

when i remove the modules work fine !!


// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },
  modules:['@pinia/nuxt'],
  
})
{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@pinia/nuxt": "^0.5.4",
    "nuxt": "^3.13.0",
    "vue": "latest",
    "vue-router": "latest"
  }
}



ahmed70738 Member
ahmed70738
0
3
135
alex Member
alex
Moderator
Solution

That's strange. Looks like you're running Nuxt 3 which should require the composition API package to be installed separately.

Have you tried:

rm -rf node_modules

And then:

npm i

To re-download dependancies.

ahmed70738 Member
ahmed70738

Hi Alex, Thank u for for your help

I was searching in nuxt githup yes I need to delete the node_modules also need install

install pnpm
run pnpm install
alex Member
alex
Moderator

Perfect, glad you got it sorted!