Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt server error on 'npm run dev' #16

Closed
DaeunYoon opened this issue Sep 5, 2022 · 8 comments
Closed

Nuxt server error on 'npm run dev' #16

DaeunYoon opened this issue Sep 5, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@DaeunYoon
Copy link
Contributor

Environment

  • Operating System: Darwin
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.9
  • Nitro Version: 0.5.1
  • Package Manager: npm@8.5.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

No response

Describe the bug

The nuxt server works with docker running, but when the server does not connect on docker, it gives a 500 server error.
However, npm run build works fine in any scenario.

Additional context

This seems similar as reported nuxt bug

Logs

Nuxi 3.0.0-rc.9                                                               14:00:38
Nuxt 3.0.0-rc.9 with Nitro 0.5.1                                              14:00:38
                                                                              14:00:39
  > Local:    http://localhost:3000/ 
  > Network:  http://192.168.2.109:3000/

ℹ Vite client warmed up in 541ms                                              14:00:41
ℹ Vite server warmed up in 139ms                                              14:00:41
✔ Nitro built in 530 ms                                                 nitro 14:00:42
DB: Initializing DB connection
DB: Successfully initialized database connection
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.
[Vue warn]: Unhandled error during execution of setup function 
  at <NuxtRoot>
[nuxt] [request error] [unhandled] [500] Cannot read properties of undefined (reading 'modules')
  at _sfc_main.setup (./node_modules/nuxt/dist/app/components/nuxt-root.vue:67:16)  
  at callWithErrorHandling (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:157:22)  
  at setupStatefulComponent (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7107:29)  
  at setupComponent (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7062:11)  
  at renderComponentVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:172:17)  
  at renderToString (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:446:26)  
  at Object.renderToString$1 [as renderToString] (./.nuxt/dev/index.mjs:661:24)  
  at Object.renderToString (./node_modules/vue-bundle-renderer/dist/runtime.mjs:173:40)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ./.nuxt/dev/index.mjs:710:21
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.
[Vue warn]: Unhandled error during execution of setup function 
  at <NuxtRoot>
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.
[Vue warn]: Unhandled error during execution of setup function 
  at <NuxtRoot>
@DaeunYoon DaeunYoon added the bug Something isn't working label Sep 5, 2022
@DaeunYoon DaeunYoon changed the title Nuxt server error Nuxt server error on 'npm run dev' Sep 5, 2022
@BracketJohn
Copy link
Contributor

Thanks!

Seems to be related to RC.9, so if you're stuck right now as a work-around you can try downgrading your version to RC.8 by doing:

npm i -D nuxt@3.0.0-rc.8

# clean all nuxt caches
npx nuxi-edge@latest cleanup

npm run dev

@zoey-kaiser
Copy link
Member

I don't have any issues running RC.9 with NodeJS V18. That could also be another fix to your issue!

@a1xon
Copy link

a1xon commented Sep 6, 2022

Tried with node lts and latest. Both don't work. Maybe OS? I'm on Linux.

@BracketJohn
Copy link
Contributor

Weird, in the meatime have you tried downgrading to rc8, the way I shared above?

@DaeunYoon
Copy link
Contributor Author

I've tested with different node versions but didn't work for me as well.
Downgrading to rc8 does work on my Mac thou.

@BracketJohn
Copy link
Contributor

@a1xon, @rustre-undefined are you two still experiencing the error with the newest sidebase version?

@pi0
Copy link

pi0 commented Sep 16, 2022

Please check nuxt/nuxt#14952 for root causes and solutions. It happens when vue dependency is installed in a parent directory with vite-node that is enabled by default for rc.9 and rc.10.

@BracketJohn
Copy link
Contributor

Thanks! I think this closes the issue for now.

If you are having this problem: Checkout if you have another vue install in a parent directory. Remove it if possible, checkout nuxt/nuxt#14952 for more information + workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants