7

I am trying to push lwc source code into a new scratch org. The source code works perfectly fine with my old scratch but when pushing to the new scratch org, I got this error:

No base file for markup://c:lwcdnd

I haven't used c-lwcdnd anywhere in my source code and I feel quite strange why this is happening. Any solutions to this issue?

I have also checked that I don't have any property defined in my meta file:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lwcdnd">
    <apiVersion>45.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>
6
  • fqn="lwcdnd"? Is this metadata in the right folder? Does it have the right name?
    – sfdcfox
    Commented Mar 24, 2019 at 12:55
  • @sfdxfox It is. Actually I created a new lwc component using the same content called lwcdnd2 and everything works just fine.
    – Lance Shi
    Commented Mar 24, 2019 at 12:58
  • Are you deploying the entire component, or just a specific file? What command are you using specifically? Did your .js file deploy successfully? Alternatively, maybe something is wrong with your json config files in the root lwc folder? There's a lot of things that can go wrong with LWC, unfortunately. If you can post any additional info that might be relevant, that'd be great.
    – sfdcfox
    Commented Mar 24, 2019 at 13:08
  • @sfdcfox Thanks for that. I am not quite sure what should I be posting here. I tried both sfdx force:source:push and the deploy folder command which I can't remember the detail of it. I was keeping my files on github but now I replaced with a new version lwcdnd2 which is working now. Thanks for that. I guess now I have made it impossible to debugging previous issue now
    – Lance Shi
    Commented Mar 24, 2019 at 22:16
  • BTW, not sure if it's intended, but it's possible to compile and push without a fqn attribute. IIRC, some of the recipes in the official trailhead repos omit this.
    – tsalb
    Commented Mar 25, 2019 at 0:10

7 Answers 7

11

I got the same error like that and later found out that all component files have to have the exact same name as the project folder. Give it a try to see if it helps.

7

My filenames were the same as the enclosing component folder just above it, so the above didn't work for me.

But what I discovered was that the component name cannot be the same name as the vs code project folder name. When I changed the name of my project folder outside of vs code and reopened the folder in vs code, deploying then worked.

2
  • this one works for me Commented Aug 1, 2019 at 17:09
  • this one works for me² Commented Sep 30, 2019 at 10:27
7

It will not get deployed if the name of LWC component starts with Capital letter. Always create LWC component with small letter.

This issue i have observed while deploying the LWC component.

1
  • 1
    This one solved my issue. Thank you @pranil Commented Dec 6, 2020 at 16:58
3

Got the same error. Try closing the VSCODE window, open it, then deploy the lwc folder. Worked for me

1
  • Right click on folder name and click 'Deploy Source to Org' worked for me. Was getting the error after creating the LWC using VS Code and trying to deploy individual files for the first time.
    – MikeA
    Commented Jan 25, 2022 at 12:27
2

Another observation, the deploy command is case sensitive for LWC components. So for instance if you do:

sfdx force:source:deploy --sourcepath force-app/main/default/lwc/mylwccomponent

and the folder name is myLwcComponent it will fail with the error mentioned in the OP.

1
  • 1
    I ran into this- then created a component with name starting with lowercase instead of uppercase and it worked
    – dmorse
    Commented Apr 14, 2021 at 15:40
0

I faced the same issue while using

sfdx force:source:deploy -u USER_NAME -p ....../default/lwc/lwcComp/xyz.html

In my case, I fount that tool is not able to deploy code if any LWC component folder has only *.html file. So after creating xyz.js and xyz.js-meta.xml, I am able to push code.

0

You may use something like this to find the error

sfdx force:source:deploy --sourcepath force-app/main/default/lwc/lwcdnd --loglevel trace

You must log in to answer this question.

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