1

I am working Lighting Web Component and when I try to deploy my code from the js file the deployment fails with following message:

=== Deploy Errors
PROJECT PATH  ERRORS                                                                        
────────────  ──────────────────────────────────────────────────────────────────────────────
              Cannot find Lightning Component Bundle CreateRecordForComunity.               
              duplicate value found: <unknown> duplicates value on record with id: <unknown>
              Cannot find Lightning Component Bundle CreateRecordForComunity.               

15:02:51.461 ended SFDX: Deploy Source to Org

But when i deploy from HTML or CSS file it works fine. I don't understand the problem as it don't specify the line number or anything why the problem is arising. I haven't done much in JS code yet

JS Code:

import { LightningElement } from 'lwc';
import fetchSobjectName from '@salesforce/apex/createRecordForCommunity.fetchSobjectName';

export default class CreateRecordForComunity extends LightningElement {
    
    sobjectOption;

    getsobjectOption(){
        fetchSobjectName().then(result=>{
            console.debug(result);
        })
    }

    connectedCallback(){
        this.getsobjectOption();
    }

}

2 Answers 2

2

I was having the same problem, but then I noticed the case of the error. My component name is "somethingCool". When I created the component, I used "SomethingCool". It changed the pascal case to camel case everywhere but the class name of the .js file.

From:

export default class SomethingCool extends LightningElement {

To:

export default class somethingCool extends LightningElement {

Once I did this, it saved/deployed no problem.

0

Make sure that component name is not duplicate in your Org.Check is there any lightning or lightning Web component already exist with same name.

If component already exist in your org, then change the component name and try to deploy.

I got similar kind of issue and resolved with above mentioned solution. I hope it will help you too.

2
  • thank you for response.....No, there isn't any component in my org with the same name. Also I don't think the problem is in name of the component because it is deploying from the other file of component(HTML, CSS) just not only from JS file. Commented Sep 30, 2022 at 13:06
  • Please try this once: Close LWC Component and Visual Studio and then again open Visual Studio and try to deploy Component. Commented Sep 30, 2022 at 18:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .