question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuxt server error on 'npm run dev'

See original GitHub issue

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>

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
BracketJohncommented, Sep 5, 2022

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
1reaction
pi0commented, Sep 16, 2022

Please check https://github.com/nuxt/framework/issues/7609 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Npm run dev crashes randomly #8639 - nuxt/nuxt.js - GitHub
Upon saving a file it compiles again but randomly aborts the whole script with the following error message: Assertion failed: ( ...
Read more >
Npm run dev doesnt start up nuxt 3 local server - Stack Overflow
Nuxt3 is using Vue3, not Vue2.7. Also, your app is fine when you run npm run dev so you don't need to run...
Read more >
Installation - Nuxt
Here, you will find information on setting up and running a Nuxt project in 4 steps.
Read more >
@nuxt/friendly-errors-webpack-plugin - npm
Recognizes certain classes of webpack errors and cleans, aggregates and prioritizes them to provide a better Developer Experience.
Read more >
'nuxt' is not recognized as an internal or external command
To solve the error "nuxt is not recognized as an internal or external command, operable program or batch file", open your terminal in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found