Skip to content
Latchkey

Vue "Failed to resolve component" - Fix in CI

Vue could not find a component referenced in a template. With <script setup> it must be imported in the same file; otherwise it must be registered. A name or case mismatch breaks resolution too.

What this error means

The build warns/errors Failed to resolve component: <Name> and the component renders as a bare tag or fails strict checks.

vue
[Vue warn]: Failed to resolve component: UserCard
If this is a native custom element, make sure to exclude it from
component resolution via compilerOptions.isCustomElement.

Common causes

Component not imported in script setup

With <script setup>, a component must be imported in the same SFC to be available in the template.

Name or case mismatch

The template tag does not match the registered/imported name, or case differs.

How to fix it

Import the component

  1. Import it in the same SFC using script setup so it resolves in the template.
App.vue
<script setup>
import UserCard from './UserCard.vue';
</script>
<template><UserCard /></template>

Register globally if shared

  1. For a widely used component, register it on the app instance.
main.ts
app.component('UserCard', UserCard);

How to prevent it

  • Prefer explicit local imports in script setup over global registration.
  • Match template tag names and case to the imported component.

Frequently asked questions

What causes "Resolve component"?
With <script setup>, a component must be imported in the same SFC to be available in the template.
How do I fix Resolve component?
Import the component

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card