You need to sign in to do that
Don't have an account?
The file or directory that you tried to deploy or retrieve isn't in a package directory
Hey guys trying to get comfortable with the Salesforce CLI, and went to deploy my code changes to my Dev Org but I keep getting the following error message. I checked out the link that they listed, but couldn't seem to figure out what issue was. I modified the JSON with the folder name that I'm trying to deploy, but still had no luck.
Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn't in a package directory that's specified in your sfdx-project.json file. Add this location to your "packageDirectories" value, or deploy or retrieve a different file or directory. For details about sfdx-project.json, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm
Sorry for this issue you are facing.
May I suggest you please refer to below link from the stack exchange community with a similar discussion and suggested workaround.
- https://salesforce.stackexchange.com/questions/249445/error-sfdx-deploy-source-to-org
Please let us know if this helps.Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra
I am facing the same issue. I have used force-app with a relative path to the directory. Still i am facing the same issue. Kindly help me on this.
If possible please provide any example of solution.
Thanks,
Shakir
My sfdx-project.json looks like the following though:
I had removed Static resource from from package.xml file then it worked fine for me.
Thanks,
Shakir
is any one find the solution for this error ,if yes please share with mw
Thanks
Sri
I too had the same problem. I got the error when i right click and Deploy to Source Org.
Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn't in a package directory that's specified in your sfdx-project.json file. Add this location to your "packageDirectories" value, or deploy or retrieve a different file or directory. For details about sfdx-project.json, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm
But i was able to deploy with the following command.
sfdx force:source:deploy --sourcepath .\force-app\main\default\classes\testFirstClass.cls --json --loglevel trace
Regards,
Chandra
Hi Guys - I had a similar issue listed above.
Resolution: Use Terminal to deploy through this command.
sfdx force:source:deploy -p force-app/main/default
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexComponent</name>
</types>
<types>
<members>*</members>
<name>ApexPage</name>
</types>
<types>
<members>*</members>
<name>ApexTestSuite</name>
</types>
<types>
<members>*</members>
<name>ApexTrigger</name>
</types>
<types>
<members>*</members>
<name>AuraDefinitionBundle</name>
</types>
<types>
<members>*</members>
<name>LightningComponentBundle</name>
</types>
<!-- <types>
<members>*</members>
<name>StaticResource</name>
</types> -->
<version>49.0</version>
</Package>
I still can't right click on the package.xml and retrieve. I instead pick the Terminal tab inside VSCode and run this command: sfdx force:source:retrieve -x manifest/package.xml
sfdx force:source:deploy -p force-app/main/default
thanks, this was it
I have resolved this issue by simply adding "/" in the path of packageDirectories,
{
"packageDirectories": [
{
"path": "/force-app",
"default": true
}
],
"name": "DevOrg",
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "52.0"
}