+ Start a Discussion

LWC Issue

I am getting the below error when i am trying to deploy the code from locale tot he scratch org

This error comes when i created a custom label in the Lightning Web Component.
Labels should have a section and a name: ProgramOverview
Ajay K DubediAjay K Dubedi
Hi Ravi,

To import Custom Labels we use @salesforce/label scope module in Lightning Web Components

import labelName from '@salesforce/label/labelReference';

labelName  ---> it is a name that refers to the label.
labelReference ---> The name of the label in your org in the format namespace.labelName

if you don't have any namespace in your org use default namespace c
Ex: c.labelReference

You can take idea for following Example:

    <lightning-card  title="Custom Label Example" variant="narrow" icon-name="standard:opportunity">


import { LightningElement } from 'lwc';

// importing Custom Label
import WelcomeLabel from '@salesforce/label/c.SalesforceCodeCrack';
export default class CustomLabelDemo extends LightningElement {
    label = {


<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="CustomLabelDemo">
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Ajay Dubedi
Hi Ajay,

Thank you, I found the solution.
raviteja p 38raviteja p 38
Hi Ravi,

What is the solution?? I'm facing the same issue now.
Hi Ravi,

I am not able to recollect, but can you provide the details of your issue along with the error screen shot that you are facing. So that i can check and tell you.
awinash kumarawinash kumar
For me this error showed up because I'd missed to include namespace(c) in the import statement.
import labelName from '@salesforce/label/labelReference';
labelReference: The name of the label in your org in the format namespace.labelName.
For example - 
import editLabel from '@salesforce/label/c.Edit';
Notice the namespace - c in the import statement, if you dont use it, you will get an error - Labels should have a section and a name: