arashsheyda / nuxt-mongoose

A Nuxt module for simplifying the use of Mongoose in your project.
https://docs.arashsheyda.me/nuxt-mongoose
75 stars 13 forks source link

module cannot be importedin server runtime #42

Closed StreakingMan closed 8 months ago

StreakingMan commented 8 months ago

A weird problem: everything works well, but I encountered the following error:

 ERROR  This module cannot be importedin server runtime. [importing @nuxt/kit from node_modules/.
pnpm/nuxt-mongoose@1.0.4_@nuxt+devtools@1.0.8_@vue+compiler-core@3.4.15_nuxt@3.9.3_postcss@8.4.33__7jpvof57gdqhocny23btsw7gu4/node_modules/nuxt-mongoose/dist/runtime/server/services/connection.mjs]

This is just for reporting purposes, and here's my environment: system: win 11 pnpm 8.5.0 nuxt 3.9.3 nuxt-mongoose 1.0.4

Khuirul-Huda commented 8 months ago

same here,

[20.29.39]  ERROR  This module cannot be importedin server runtime. [importing @nuxt/kit from node_modules/nuxt-mongoose/dist/runtime/server/services/connection.mjs]

nuxt-mongoose 1.0.4

arashsheyda commented 8 months ago

this has happened after updaing to latest nuxt version (not sure why and can't see effecting anything), I'll try to find the a solution

manniL commented 8 months ago

@arashsheyda You should not use the nuxt kit logger in runtime code. Instead, use consola

https://github.com/arashsheyda/nuxt-mongoose/blob/64a4fa5383fd766f4f5fd325c9bb3c902a46a229/src/runtime/server/services/connection.ts#L2C1-L2C8

sajt commented 8 months ago

@manniL Yes! That was the problem.

arashsheyda commented 8 months ago

@manniL thank you so much! you saved the day :)