How can I avoid the ERROR running force:source:deploy: No source backed components present in the package?

968    Asked by Aalapprabhakaran in Salesforce , Asked on Aug 29, 2023

 I want to filter the price label to be updated and deployed. But when I am trying to deploy, I am getting the below error: no source backed components present in the package, which looks like the part provided below: 

I have also tried updating CLI, value and onchange too, and removing spaces.However, the error persists. Any suggestions will be helpful.


 Firstly, you can check the file type in .forceignore. Then, check that you are in the correct directory. You can be sure of this if you can see an sfdx-project.json file. If not, then check from your command shell, try dir /s sfdx-project.json, and use the correct directory:




Go to the directory and then run the code from there. You can verify whether your org is correctly connected in the lower-left corner. You can see the org's username or alias (here, sfdcfox). If not, click the plug icon and select the correct org. This error suggests that your force-app directory is empty. Keep your files in the right place.

Your sfdx-project.json file should be like the below:


Your Answer

Answer (1)

The error "ERROR running force:source:deploy: No source backed components present in the package" typically occurs when attempting to deploy metadata to a Salesforce org using the Salesforce CLI (sfdx) but the specified source files are not found or are not recognized as valid metadata components.

Here are some steps to troubleshoot and resolve this issue:

1. Verify Your Source Directory Structure

Ensure that your source files are in the correct directory structure as expected by Salesforce. The default structure should follow the force-app/main/default hierarchy. For example:

force-app/
└── main/
    └── default/
        ├── classes/
        │ ├── MyClass.cls
        │ └── MyClass.cls-meta.xml
        ├── objects/
        │ └── MyCustomObject__c/
        │ ├── MyCustomObject__c.object
        └── ...

2. Check the Manifest File (package.xml)

If you are using a package.xml file to specify which components to deploy, make sure it correctly references the components you want to deploy. Here is an example of a simple package.xml:



   

        *

        ApexClass

   

   

        *

        CustomObject

   

    55.0

3. Specify the Correct Source Path

Ensure you are specifying the correct path to your source files in the sfdx force:source:deploy command. For example, if your source files are in force-app/main/default, use:

sfdx force:source:deploy -p force-app/main/default

4. Include the Correct Metadata Types

If you are deploying specific metadata types, make sure they are included and correctly defined in your source directory or package.xml. For example, ensure that all necessary files (e.g., *.cls, *.object, *.trigger) are present and










5 Months

Interviews

Parent Categories