Denoder / nuxt-module-alternatives

Alternative modules to use while waiting for Nuxt 3 Compatibility
MIT License
144 stars 14 forks source link

Cannot find module 'pinia.mjs' after upgrading to nuxt3-rc5 #50

Closed ahoiroman closed 2 years ago

ahoiroman commented 2 years ago

Using nuxt3-rc5 I am getting the following error:

[nuxt] [request error] Cannot find module '/Users/ahoiroman/Entwicklung/nuxtjs/test/.output/server/node_modules/pinia/dist/pinia.mjs' imported from /Users/ahoiroman/Entwicklung/nuxtjs/test/.output/server/chunks/app/server.mjs
  at new NodeError (node:internal/errors:377:5)  
  at finalizeResolution (node:internal/modules/esm/resolve:405:11)  
  at moduleResolve (node:internal/modules/esm/resolve:966:10)  
  at defaultResolve (node:internal/modules/esm/resolve:1174:11)  
  at ESMLoader.resolve (node:internal/modules/esm/loader:605:30)  
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18)  
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)  
  at link (node:internal/modules/esm/module_job:78:36)

And yes, /Users/ahoiroman/Entwicklung/nuxtjs/test/.output/server/node_modules/pinia/dist/pinia.mjs does not exist. There is only a file called pinia.prod.cjs

Denoder commented 2 years ago

currently looking into it

pankaj-bigdotjobs commented 2 years ago

Facing similer issue after rc.5

Failed to resolve import "pinia" from "../.nuxt/pinia.plugin.mjs". Does the file exist?

Denoder commented 2 years ago

Update the auth module, and remove @nuxtjs-alt/pinia and start using @pinia/nuxt instead.

ahoiroman commented 2 years ago

For me it's not solved :-/

------------------------------
- Operating System: `Darwin`
- Node Version:     `v18.2.0`
- Nuxt Version:     `3.0.0-rc.5`
- Package Manager:  `npm@8.9.0`
- Builder:          `vite`
- User Config:      `build`, `buildModules`, `modules`, `publicRuntimeConfig`, `privateRuntimeConfig`, `globalName`, `app`, `router`, `intlify`, `axios`, `proxy`, `auth`, `tailwindcss`, `googleFonts`
- Runtime Modules:  `@pinia/nuxt@0.3.0`, `@nuxtjs-alt/auth@1.2.3`, `@nuxtjs-alt/axios@1.0.12`, `@nuxt/content@2.0.1`, `@nuxtjs/tailwindcss@5.3.0`
- Build Modules:    `@intlify/nuxt3@0.2.3`, `@nuxtjs-alt/google-fonts@1.0.5`
------------------------------
{
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "start": "env-cmd -f ./.env  node .output/server/index.mjs"
  },
  "devDependencies": {
    "@headlessui/vue": "^1.6.6",
    "@heroicons/vue": "^1.0.6",
    "@intlify/nuxt3": "^0.2.2",
    "@nuxt/content": "^2.0.1",
    "@nuxt/kit": "npm:@nuxt/kit-edge@latest",
    "@nuxtjs-alt/auth": "^1.1.20",
    "@nuxtjs-alt/axios": "^1.0.10",
    "@nuxtjs-alt/google-fonts": "^1.0.5",
    "@nuxtjs-alt/proxy": "^1.2.2",
    "@nuxtjs/tailwindcss": "^5.1.2",
    "@pinia/nuxt": "^0.3.0",
    "autoprefixer": "10.4.7",
    "axios": "^0.27.2",
    "axios-retry": "^3.2.5",
    "date-fns": "^2.28.0",
    "env-cmd": "^10.1.0",
    "google-fonts-helper": "^3.0.0",
    "laravel-echo": "^1.12.0",
    "lodash": "^4.17.19",
    "nuxt": "3.0.0-rc.5",
    "pinia": "^2.0.16",
    "pusher-js": "^7.1.1-beta",
    "vee-validate": "^4.6.0",
    "vue": "^3.2.33",
    "yup": "^0.32.11"
  }
}
ahoiroman commented 2 years ago

Okay - I guess the order of the modules is important:

Using this order, the error is gone:

    modules: [
        '@nuxtjs-alt/auth',
        '@nuxtjs-alt/axios',
        '@nuxt/content',
        '@nuxtjs/tailwindcss',
        '@pinia/nuxt',
    ],
Denoder commented 2 years ago

module order is stated in this repository's readme: image

ahoiroman commented 2 years ago

Thanks for pointing that out.

In this case: It's working fine for me. Thank you for your work.