[SalesForce] Trailhead Dreamhouse: ERROR running force:source:deploy: No source backed components present in the package

I'm new to Salesforce and am stuck on amending the price filter in the DreamHouse trailhead project.

The label for the price filter needs to be updated and deployed, but when I try to deploy the change the below error message keeps popping up in Visual Studio:

PS C:\Users\Carol\Desktop\VS Code\HelloWorldLightningWebComponent> sfdx force:source:deploy -m LightningComponentBundle:propertyFilter
*** Deploying with SOAP API ***
ERROR running force:source:deploy: No source backed components present in the package

I tried updating CLI, it is version: sfdx-cli/7.123.0 win32-x64 node-v14.18.1.

The exercise only asks to update the label to "Max to Spend". I tried updating value and onchange too, and removing spaces.

Also tried SFDX: Authorize an Org from the command prompt, in case there was an issue with Visual Studio connecting to the org.

Same error every time I try to deploy the change: ERROR running force:source:deploy: No source backed components present in the package.

Any ideas? Thank you for your help!

Best Answer

If I had to guess, I'd say you're either in the wrong directory, or you're missing one or more components you need.

First, make sure you're in the correct directory. You'll know you are because you'll see an sfdx-project.json file.

sfdx-project.json

If your Explorer doesn't look like this, verify that you're in the correct directory. In your command shell, try dir /s sfdx-project.json and use the correct directory:

sfdx-project.json for Dreamhouse

Switch to that directory and run Code from there.

Running VS Code on directory

After that, you can verify if your org is properly connected in the lower-left corner:

Connected Status

The plug icon should show your org's username or alias (here, sfdcfox). If this isn't right, click on the plug icon and choose the correct org (or you can authorize a new org).

Authorize an Org Dropdown

Now, this specific error suggests that your force-app directory is empty. Make sure your files are in the right place:

propertyFilter.html

If it doesn't look like this, there's a problem. Also, double-check your sfdx-project.json file, it should be exactly:

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "DreamhouseLWC",
            "versionName": "Summer '21",
            "versionNumber": "53.0.0.NEXT"
        }
    ],
    "namespace": "",
    "sourceApiVersion": "53.0",
    "packageAliases": {
        "DreamhouseLWC": "0Ho3h000000PBghCAG",
        "DreamhouseLWC@50.0.0-1": "04t3h000004skyPAAQ",
        "DreamhouseLWC@50.0.0-6": "04t3h000004slZvAAI",
        "DreamhouseLWC@50.0.0-8": "04t3h000004sla5AAA",
        "DreamhouseLWC@50.0.0-11": "04t3h000004slorAAA",
        "DreamhouseLWC@50.0.0-16": "04t3h000004sm0nAAA",
        "DreamhouseLWC@50.0.0-22": "04t3h000004sm5nAAA",
        "DreamhouseLWC@50.0.0-26": "04t3h000004sm67AAA",
        "DreamhouseLWC@50.0.0-28": "04t3h000004smaYAAQ",
        "DreamhouseLWC@51.0.0-1": "04t3h000004smn8AAA",
        "DreamhouseLWC@53.0.0-1": "04t3h000004VW48AAG",
        "DreamhouseLWC@53.0.0-3": "04t3h0000043sQIAAY",
        "DreamhouseLWC@53.0.0-5": "04t3h0000043scGAAQ"
    }
}

If it doesn't, try pulling down the repository to get the latest changes (note to future visitors: if this changes, feel free to modify this answer or let me know).


In summary, make sure you're connected to the right org, make sure you're in the right directory, make sure no files are missing, etc. I did verify that this is working (the modified file deployed successfully), so it is likely something you've done incorrectly. Try cloning a fresh copy of the git repository and try again, paying close attention to which directory the files are cloned in to.

Related Topic