The requested module 'vue' does not provide an export named 'default'
enkot opened this issue · 2 comments
Trying to use pinia
or vue-use
in the fresh Nuxt3 project, but getting this error:
[nuxt] [request error] [unhandled] [500] The requested module 'vue' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
at async ViteNodeRunner.interopedImport (./node_modules/.pnpm/vite-node@0.23.4/node_modules/vite-node/dist/client.mjs:268:17)
at async ViteNodeRunner.directRequest (./node_modules/.pnpm/vite-node@0.23.4/node_modules/vite-node/dist/client.mjs:175:24)
at async ViteNodeRunner.cachedRequest (./node_modules/.pnpm/vite-node@0.23.4/node_modules/vite-node/dist/client.mjs:128:12)
at async request (./node_modules/.pnpm/vite-node@0.23.4/node_modules/vite-node/dist/client.mjs:151:16)
at async ./node_modules/.pnpm/@vueuse+shared@9.2.0/node_modules/@vueuse/shared/index.mjs:1:238
at async ViteNodeRunner.directRequest (./node_modules/.pnpm/vite-node@0.23.4/node_modules/vite-node/dist/client.mjs:251:5)
package.json:
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"devDependencies": {
"@vueuse/nuxt": "^9.2.0",
"@pinia/nuxt": "^0.4.2",
"nuxt": "3.0.0-rc.11"
}
}
Environment:
- Operating System: `Darwin`
- Node Version: `v16.17.0`
- Nuxt Version: `3.0.0-rc.11`
- Nitro Version: `0.5.4`
- Package Manager: `pnpm@7.12.1`
- Builder: `vite`
- User Config: `-`
- Runtime Modules: `-`
- Build Modules: `-`
Look like this pinia problem. As it uses vue-demi@0.13.8 https://github.com/vuejs/pinia/blob/v2/pnpm-lock.yaml#L116.
While there is an attempt to fix this in the latest version of vue-demi v0.13.10...v0.13.11
But probably i'm wrong as this one antfu/vitesse-nuxt#61 doesn't work as well
We were running into this problem intermittently locally when we were updating to Vue3. We found that when switching between the "Vue2" and "Vue3" branches, we'd sometimes need to delete our node_modules
and rerun yarn install
.
So it seems like maybe a yarn issue where somehow it isn't clearing out old stuff, and old and new node_modules are interfering with one another...?