Cannot start nuxt: Cannot convert undefined or null to object
I have started a new project and fallowed instructions of getting started installation page.
Only commands I executed to install and start nuxt in dev mode:
npx nuxi@latest init my-project
npm run dev
(in my-project directory)
I am getting this error:
Cannot start nuxt: Cannot convert undefined or null to object =
at Function.values (<anonymous>)
at configureServer (node_modules/vite-plugin-inspect/dist/index.mjs:1410:12)
at configureServer (node_modules/vite-plugin-inspect/dist/index.mjs:1496:19)
at _createServer (node_modules/@nuxt/vite-builder/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:63080:26)
at async buildClient (node_modules/@nuxt/vite-builder/dist/shared/vite-builder.B69gK6ir.mjs:733:24)
at async withLogs (node_modules/@nuxt/vite-builder/dist/shared/vite-builder.B69gK6ir.mjs:1781:3)
at async bundle (node_modules/@nuxt/vite-builder/dist/shared/vite-builder.B69gK6ir.mjs:1772:3)
at async bundle (node_modules/nuxt/dist/index.mjs:6091:5)
at async build (node_modules/nuxt/dist/index.mjs:5966:3)
at async Promise.all (index 1)
If I run preview, it works. This issue is only in dev mode. Any ideas why or how to fix it?5 Replies
Hi @Rechau. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the knowledge sources, there isn't a direct solution to the specific error you're encountering. However, I can offer some general troubleshooting steps and advice based on related issues in Nuxt:
1. First, ensure you're using a compatible Node.js version. As mentioned in the installation prerequisites (https://nuxt.com/docs/getting-started/installation), Nuxt requires Node.js v18.0.0 or newer, preferably an even-numbered version (18, 20, etc.).
2. Try upgrading Nuxt to the latest version using the following command:
This command is mentioned in the upgrade guide (https://nuxt.com/docs/getting-started/upgrade) and can help refresh the lockfile, which might resolve dependency-related issues.
3. The error you're seeing seems to be related to a Vite plugin. It's possible that there's a conflict or issue with the vite-plugin-inspect. You could try temporarily disabling any Vite-related configurations in your
nuxt.config.ts
file if you have any, to see if that resolves the issue.
4. If the issue persists, it might be helpful to create a minimal reproduction of the problem. As suggested in the reporting bugs guide (https://nuxt.com/docs/community/reporting-bugs), you can use the Nuxt sandbox on StackBlitz or CodeSandbox to create a minimal example that demonstrates the issue.
5. If none of the above steps help, consider reporting this as a potential bug. Follow the guidelines in the reporting bugs (https://nuxt.com/docs/community/reporting-bugs) documentation to create a detailed bug report, including your minimal reproduction, exact Nuxt version, and Node.js version.
Remember, since the preview mode is working, it's likely that this issue is specific to the development environment or configuration. If you continue to face issues, don't hesitate to seek further help through the official Nuxt community channels or by creating a detailed bug report.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@159739178454745090> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Looks like I solved this issue. It's caused by devtools. By disabling it in nuxt.config.ts
devtools: {enabled: false}
it works and runs dev server. So there is some sort of a bug in devtools which is not letting dev server to spin up.So devtools don't work in the latest nuxt version?
After more investigation if you are using npm you need to disable dev tools. If you are using yarn then devtools work. It's a package manager issue. All of this depends on nuxt and npm versions. Gave up for now since there are more issues like not working type check with nuxi and who knows what else.