Lightning component cannot be created: c:myComponent
The framework couldn't instantiate a Lightning component at runtime — usually a missing dependency, a permission gap, or a static-resource load failure. The browser console has the actual cause; this user-facing message is generic.
Also seen asLightning component cannot be created·Component cannot be created·Failed to create component
This message fires when the Lightning runtime tries to construct a component instance and fails. It's bundled — multiple distinct causes show the same user-facing string.
Diagnose in the browser console
Open DevTools → Console before the page reload. The actual error appears as one or more red lines:
| Console message | Cause |
|---|---|
Failed to load chunk c.myComponent | The component bundle didn't deploy or is server-side-only |
Cannot read properties of undefined ... | Apex callback returned null/undefined where the component expected data |
Refused to load script ... | CSP blocked a static-resource script (see the CSP error) |
Insufficient privileges | The running user can't access an underlying SObject the component queries |
Component definition not found | The component isn't in the org or hasn't deployed yet |
Each maps to a different fix. The user-facing "Lightning component cannot be created" message tells you the symptom; the console tells you the cause.
When the component existed before but stopped working
A component that was working and now isn't usually means:
- A dependent Apex class was deleted without updating the component
- A static resource was removed (or its permissions changed)
- An LWC dependency was renamed but not all references were updated
- A namespace prefix conflict after installing a managed package
Roll back the most recent deploy to confirm; if it goes back to working, the deploy introduced the issue.
When it's intermittent
Some users see it, others don't. Likely a permission gap:
- The component does
getRecord({fields: ['Account.Industry__c']})but the user can't readIndustry__c. The wire fails; the component's render path errors. - The component imports an
@AuraEnabledApex method that's@AuraEnabled(cacheable=true), but the user lacks Read on the underlying object the method queries. Apex throws; the component receives an error, doesn't handle it, fails.
Fix: handle errors in the component:
@wire(getRecord, { recordId: '$recordId', fields: FIELDS })
record({ data, error }) {
if (error) { this.errorMessage = 'Could not load this record'; return; }
if (data) { this.process(data); }
}
Don't just assume the wire succeeds. The error case is part of the contract.
When the component is custom and brand-new
Newly-deployed components sometimes can't be instantiated because:
- The deploy succeeded but the component metadata wasn't activated
- A required dependency (LDS module, Apex class, custom label) isn't available
- The org's API version doesn't support an LWC syntax used in the component
For new component issues, rebuild the deploy pipeline locally with sf project deploy start --source-dir force-app/main/default/lwc/myComponent. Check the deploy logs for warnings — those often precede the runtime failure.
In Aura, the message is slightly different
Aura's flavour: Component cannot be created: markup://c:myAuraComp. The triage is the same — open DevTools, find the JS error inside the bracket, fix the cause.
