nuxt-mongoose
nuxt-mongoose copied to clipboard
Import Error in github action
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?
@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:
- The error messages above were shown during the
nuxt build
process (after building client bundle and before finish building nitro server bundle) - When I run
nuxt build
on my Mac laptop, the.output/server/chunks/_/model.mjs
will include the function implementation ofdefineMongooseModel
, but when runningnuxt build
on the GitHub Action machine, the.output/server/chunks/_/record.schema.mjs
DOES NOT include the implementation of functiondefineMongooseModel
- I tried to make a minimal reproduction on StackBlitz but FAILED because the
nuxt build
runs very well on the StackBlitz's container
I'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