Open proggreg opened 7 months ago
@proggreg can you share a small reproduction? thanks
I met the same issue. The most weird thing is that when I try to build on my mac laptop(in the project folder), it works well, but when I try to build the project on the machine of github actions, it reports error.
(node-resolve plugin) Could not resolve import "#nuxt/mongoose"
in /home/runner/work/sensor-attention/sensor-attention/server/models/record.schema.ts
using imports defined in /home/runner/work/sensor-attention/sensor-attention/package.json.
(node-resolve plugin) Could not resolve import "#nuxt/mongoose"
in /home/runner/work/sensor-attention/sensor-attention/server/models/record.schema.ts
using imports defined in /home/runner/work/sensor-attention/sensor-attention/package.json.
"#nuxt/mongoose" is imported by "server/models/record.schema.ts", but could not be
resolved – treating it as an external dependency.
I met the same issue. The most weird thing is that when I try to build on my mac laptop(in the project folder), it works well, but when I try to build the project on the machine of github actions, it reports error.
(node-resolve plugin) Could not resolve import "#nuxt/mongoose" in /home/runner/work/sensor-attention/sensor-attention/server/models/record.schema.ts using imports defined in /home/runner/work/sensor-attention/sensor-attention/package.json. (node-resolve plugin) Could not resolve import "#nuxt/mongoose" in /home/runner/work/sensor-attention/sensor-attention/server/models/record.schema.ts using imports defined in /home/runner/work/sensor-attention/sensor-attention/package.json. "#nuxt/mongoose" is imported by "server/models/record.schema.ts", but could not be resolved – treating it as an external dependency.
Additional information:
nuxt build
process (after building client bundle and before finish building nitro server bundle)nuxt build
on my Mac laptop, the .output/server/chunks/_/model.mjs
will include the function implementation of defineMongooseModel
, but when running nuxt build
on the GitHub Action machine, the .output/server/chunks/_/record.schema.mjs
DOES NOT include the implementation of function defineMongooseModel
nuxt build
runs very well on the StackBlitz's containerI've found the reason and made a minimal reproduction , see #54 😄
Not sure if this is an issue with the module but I'm having an issue when running nuxt in dev. I get this error [worker reload] [worker init] Package import specifier "#nuxt/mongoose".
Don't suppose you know what the issue might be?
I was wondering to ask you if this issue has been resolved? If it is not resolved, please check whether you've specified the uri
parameter in the mongoose configuration of nuxt.config.ts
?
// nuxt.config.ts
export default defineNuxtConfig({
// ...
mongoose: {
uri: 'your mongodb connection string here',
options: {},
modelsDir: 'models',
},
})
I've made a reproduction 👉 nuxt-mongoose PR issue#52 reproduction [worker init] (forked) - StackBlitz. In this reproduction, run npm i
and npm run dev
to reproduce the [worker init] [woker reload] ....
error above, then add uri
to mongoose.uri
in nuxt.config.ts
, the error will not ring anymore.
It's nearly the same problem as #54.
cc @arashsheyda
I'll make a release later today and then we can make sure. thanks again
Not sure if this is an issue with the module but I'm having an issue when running nuxt in dev. I get this error [worker reload] [worker init] Package import specifier "#nuxt/mongoose".
Don't suppose you know what the issue might be?