Skip to content

fix: Cannot start nuxt: Failed to get devtools context #702

Open
@remihuigen

Description

@remihuigen

🐛 The bug

When using (the latest version of) Nuxt Devtools and Nuxt Seo, Nuxt won't start in dev mode. See also harlan-zw/nuxt-seo#242

// package.json
{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@nuxtjs/seo": "^2.0.0-rc.16",
    "nuxt": "^3.12.4",
    "vue": "latest"
  }
}
// nuxt.config.ts
export default defineNuxtConfig({
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },
  modules: ["@nuxtjs/seo"]
})

Gives error

 ERROR  Cannot start nuxt:  Failed to get devtools context.                                                                                                                                                                                                                                                                               12:05:49 PM

  at extendServerRpc (node_modules/@nuxt/devtools-kit/dist/index.mjs:96:11)
  at node_modules/@nuxtjs/robots/dist/module.mjs:167:5
  at node_modules/hookable/dist/index.mjs:48:66
  at Object.run (node_modules/hookable/dist/index.mjs:41:43)
  at node_modules/hookable/dist/index.mjs:48:56
  at async enableModule (/Users/remihuigen/.nvm/versions/node/v16.19.1/lib/node_modules/@nuxt/devtools/dist/chunks/module-main.mjs:8466:3)
  at async normalizedModule (/Users/remihuigen/.nvm/versions/node/v16.19.1/lib/node_modules/@nuxt/devtools/node_modules/@nuxt/kit/dist/index.mjs:169:17)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2468:95)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:4496:5)
  at async NuxtDevServer._load (node_modules/nuxi/dist/chunks/dev2.mjs:6875:5)

The stackblitz reproduction is giving a different error though (it wont start either)

[12:11:04]  ERROR  [worker reload] [worker init] Cannot find package '@css-inline/css-inline-wasm' imported from /home/projects/nuxt-starter-rbifnw/.nuxt/dev/index.mjs

  at __node_internal_captureLargerStackTrace2 (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:101:5335)
  at new NodeError (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:101:4149)
  at packageResolve (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:158:9724)
  at moduleResolve (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:158:10188)
  at defaultResolve (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:158:12372)
  at ModuleLoader.defaultResolve (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:154:3284)
  at ModuleLoader.resolve (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:154:2989)
  at ModuleLoader.getModuleJob (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:154:1938)
  at https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:155:1047
  at _0x25ddf3.link (https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/blitz.41692973.js:40:796147)
  at https://nuxtstarterrbifnw-capv.w-credentialless-staticblitz.com/builtins.1003299b.js:155:1002

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-starter-rbifnw?file=nuxt.config.ts

🌈 Expected behavior

I excepted the dev server to start with devtools enabled :)

ℹ️ Additional context

I first reported this bug in the nuxt seo repo, but according to @harlan-zw it's an upstream issue...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions