0

I was trying to upload to a Salesforce dev org, a Lightning Web component called "myFirstLwc", and i have this error:

No base file for markup://c:myFirstLWC

I kind of know why. At First "myFirstLWC" was the name of the component. Then i found out a component being used inside another one, needs to be camelCase, so if the name is

myFirstLwc

in the code, it becomes

<c-my-first-lwc />

so in vscode, i renamed the files to be:

myFirstLwc.css
myFirstLwc.html
myFirstLwc.js
myFirstLwc.js-meta.xml

In Metadata, i also corrected:

<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="myFirstLwc">

So now i don't have any mention to that "myFirstLWC" string, and i looked in the entire project

After deleting the component in the org, i thought i could now upload it with correct names. But computer says "no":

No base file for markup://c:myFirstLWC

now i'm trying to correct this, with all possible sfdx commands or even workbench, but nothing. I don't know if it should still be here, but:

enter image description here

Those are the other LWC components uploaded before

sfdx won't help me debugging in a dev org:

sfdx force:source:push --loglevel trace

ERROR running force:source:push: This command can only be used on orgs that have source tracking enabled, such as sandboxes and scratch orgs.

I'm now uploading a very minimalist code

myFirstLwc.html

<template>
</template>

myFirstLwc.js

import { LightningElement } from 'lwc';
export default class myFirstLwc extends LightningElement {}

myFirstLwc.js-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="myFirstLwc">
    <apiVersion>52.0</apiVersion>
    <isExposed>false</isExposed>
</LightningComponentBundle>
5
  • 1
    Please check the name of the folder, does it match the case of your component? Also try restarting VS code, it should trigger refresh of files.
    – manjit5190
    Jul 16, 2021 at 21:33
  • Thanks for the reply. Yes the name is exactly the same string in all the files and in the directory name. Before rebooting vscode i did "sfdx update", then rebooted computer. The issue remains Jul 16, 2021 at 23:54
  • I know i could copy this code to a new component, and continue from there. But if this happens in the sandbox of a real company, and not my dev org, that cannot be a good policy. There must be a way to clean metadata from old files Jul 16, 2021 at 23:59
  • Can you try pulling all lwc related metadata again in your VSCode via sfdx. That should refresh the list of LWC components sfdx might be holding in its cache or something. Jul 17, 2021 at 2:29
  • looking into how to do that. From worbench and vscode > org browser:metadata, that string isn't showing. Now trying Ant Jul 17, 2021 at 17:59

1 Answer 1

1

Odds are, the reference is in your project folder under .sfdx/orgs/*org-name*/ in two files, sourcePathInfos.json and maxRevision.json. These files are not searched by default, however, they would be the most likely cause for this problem. The fix is rather easy. From your shell, just do:

rm -rf .sfdx/orgs/

This will purge all your cached metadata, and should set you off with a clean slate. Your next push/pull/deploy/retrieve may take longer, as the cache needs to be rebuilt, but this should fix your problem.

2
  • in .sfdx\orgs[ my SF user ]\sourcePathInfos.json.bak i found lots of references for myFirstLwc, none for myFirstLWC. It's the only file in that orgs directory. But i only noticed your answer after trying to upload for the 5th time: and then it was working. Thanks for the help anyway Jul 17, 2021 at 16:46
  • thanks. if it happens again, i use this Jul 29, 2021 at 11:11

You must log in to answer this question.

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