content icon indicating copy to clipboard operation
content copied to clipboard

[Vue warn]: Failed to resolve component: MDCRenderer when upgrading to Nuxt 3.8.2

Open mklueh opened this issue 1 year ago • 20 comments

Environment

Nuxt project info: 19:20:01


  • Operating System: Windows_NT
  • Node Version: v20.7.0
  • Nuxt Version: 3.8.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.7.2
  • Package Manager: [email protected]
  • Builder: -
  • User Config: extends, devtools, dev, debug, modules, typescript, ssr, routeRules, nitro, linkChecker, css, runtimeConfig, app, build, nuxtIcon, vueuse, content, experimental
  • Runtime Modules: @unocss/nuxt, @nuxt/content, @vueuse/[email protected], nuxt-icon, @nuxtjs/mdc
  • Build Modules: -

👉 Report an issue: https://github.com/nuxt/nuxt/issues/new 19:20:01

👉 Suggest an improvement: https://github.com/nuxt/nuxt/discussions/new

👉 Read documentation: https://nuxt.com

Reproduction

This is my content config, that has not changed for a long time

  content: {
    documentDriven: false,

    highlight: {
      // Theme used in all color schemes.
      theme: "github-light",
      preload: [
        "diff",
        "ts",
        "ini",
        "docker",
        "js",
        "css",
        "java",
        "groovy",
        "markdown",
        "sql",
        "xml",
        "json"
      ]
    },

    markdown: {
      mdc: true,
      toc: {
        depth: 4,
        searchDepth: 4
      }
    }
  },
```

and I'm using the ContentRenderer like this

```
<ContentRenderer :value="post"/>
```

### Describe the bug

I'm suddenly getting

```
[Vue warn]: Failed to resolve component: MDCRenderer
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Component <Anonymous> is missing template or render function.
```

for my application.


I've dropped in `@nuxtjs/mdc` in hope it would resolve the missing component, but seems to be not related.

### Additional context

_No response_

### Logs

_No response_

mklueh avatar Nov 21 '23 18:11 mklueh

I am having the same issue

shershen08 avatar Nov 21 '23 22:11 shershen08

@shershen08 glad to hear I'm not the only one

mklueh avatar Nov 21 '23 22:11 mklueh

it worked OK for me before I tried adding @nuxt/ui module 2h ago... it seems some deps has been updated during this install

shershen08 avatar Nov 21 '23 22:11 shershen08

@mklueh I managed to fix it by setting the exact the versions of the following pkgs:

    "@nuxt-themes/docus": "1.15.0",
    "@nuxt/content": "2.8.0",

especially check @nuxt/content - 2.8.0, is 1 minor below latest which is 2.9.0

shershen08 avatar Nov 21 '23 22:11 shershen08

@shershen08 I'm neither using the docus theme, nor nuxt ui, but I got it working with nuxt/content:2.9.0 by downgrading some other packages 😅 will look into it more tomorrow

Edit: it happens as soon as I raise those Nuxt version numbers from 3.8.1 to 3.8.2

image

mklueh avatar Nov 21 '23 23:11 mklueh

I'm having the same problem. This works

    "@nuxt/content": "2.8.5",
    "nuxt": "^3.8.2"

So does this

  "@nuxt/content": "2.9.0",
  "nuxt": "^3.8.1"

But this won't

  "@nuxt/content": "2.9.0",
  "nuxt": "^3.8.2"

wJoenn avatar Nov 25 '23 09:11 wJoenn

Same issue here

robinsimonklein avatar Nov 29 '23 17:11 robinsimonklein

I've resolved it somehow and it works with

 "@nuxt/content": "2.9.0",
  "nuxt": "^3.8.2"

I had the suspicion, that

import { transformerVariantGroup } from "unocss";

was responsible, so I removed it and it resolved it "somehow" in my reproducer project.

But then the issue appeared again and then I've upgraded

nuxt-seo-kit and replaced it with the new version @nuxtseo/module

https://nuxtseo.com/nuxt-seo/getting-started/installation

Pls check if you have those packages in place

mklueh avatar Nov 29 '23 18:11 mklueh

Having same issue, here is my package.json (after downgrading to v3.8.1): image However, this did not help. I reverted all changes to package.json and package-lock.json, and it still does not work. No clue why... image)

paranoidPhantom avatar Dec 11 '23 23:12 paranoidPhantom

Could you try upgrading to latest version of Nuxt and Content module with clean install? (update versions, remove your lock file and then install deps)

farnabaz avatar Dec 12 '23 10:12 farnabaz

I just ran npx nuxi upgrade (remove node_modules and yarn.lock). And it works 🤷‍♂️.

My deps CleanShot 2023-12-12 at 11 55 07

botmaster avatar Dec 12 '23 10:12 botmaster

This is a common issue with lets say all package manager that creates conflict between different versions of packages. As for this issue, different versions of scule package might exists in your lock file and it caused this propblem.

farnabaz avatar Dec 12 '23 10:12 farnabaz

I just ran npx nuxi upgrade (remove node_modules and yarn.lock). And it works 🤷‍♂️.

My deps CleanShot 2023-12-12 at 11 55 07

not working

mrkclub2 avatar Dec 22 '23 21:12 mrkclub2

i am having the same issue just initialized a project and getting this error after running development server

Revaycolizer avatar Dec 25 '23 19:12 Revaycolizer

same issue

MrSunshyne avatar Dec 29 '23 13:12 MrSunshyne

Same issue, did everything above, not helping.

paranoidPhantom avatar Dec 29 '23 16:12 paranoidPhantom

Made a blank code-sandbox with only Nuxt 3.9.0 and MDC 0.3.0 and it still does not resolve the component.

paranoidPhantom avatar Dec 30 '23 17:12 paranoidPhantom

In Nuxt content documentation,

Components that are used in Markdown has to be marked as global in your Nuxt app if you don't use the components/content/ directory.

I use Nuxt ^3.9.3 and Nuxt content ^2.11.0

If I create component ~/components/content/Card.vue component not detected, If I create component ~/components/content/Card.global.vue component still not detected, And I update nuxt configuration

export default defineNuxtConfig({
  components: {
     global: true,
     dirs: ['~/components']
  },
})

Component detected in my markdown content file. I hope problem solved in you all too.

okumaru avatar Feb 14 '24 15:02 okumaru

@farnabaz haven't seen this issue in a while. I'm using nuxt 3.11.1 and /content 2.12.1 now and everything work as intended.

Issue can probably be closed

wJoenn avatar Apr 04 '24 21:04 wJoenn

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Aug 21 '24 01:08 github-actions[bot]