6

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>
  • fqn="lwcdnd"? Is this metadata in the right folder? Does it have the right name? – sfdcfox Mar 24 '19 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 Mar 24 '19 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 Mar 24 '19 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 Mar 24 '19 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 Mar 25 '19 at 0:10
6

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.

6

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.

  • this one works for me – AngelSalazar Aug 1 '19 at 17:09
  • this one works for me² – MarlonJhow Sep 30 '19 at 10:27
4

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
    This one solved my issue. Thank you @pranil – Pruthvi Raj Dec 6 '20 at 16:58
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

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.

0

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

New contributor
Paula Cruz is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.