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 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
- Import it in the same SFC using script setup so it resolves in the template.
<script setup>
import UserCard from './UserCard.vue';
</script>
<template><UserCard /></template>Register globally if shared
- For a widely used component, register it on the app instance.
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.