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"
}
1 - I returned the "Salesforce CLI" extension to version 55.3.0
2 - Then, I cleaned the connection of my Org (deactivate the ones I didn't use) and I connected from VSCode to the Playground that was "Developer Edition".
3 - I reopened VSCode and that's it! I was able to do the Deploy with right click and pass the challenge I was going through.
I hope it works for you!
P/D: If you don't understand something, excuse me, I don't speak English well.
Here is the clarfication on step one for those like me.. go to vscode-- extensions--select salesforce cli integration--on right pane try to uninstall then it will ask if you want to install a specific version... choose 55.3.0 .. enable if not done already... re authorize the org.
I've managed to solve this issue by just changing the Salesforce CLI version 55.4.1 to 55.3.0:
Just goto Extention in VS code >> Search for Salesforce CLI Integration >> near Uninstall button there is drop-down >> Install another version (55.3.0).
hope this will solve your problem.
I've managed to solve this issue
you have to just check if your CLI is not updated then update your salesforce CLI version 55.4.1
and if your CLI is updated then also is not working then change your salesforce CLI version 55.4.1 to 55.3.0
you can change the CLI version from Just goto Extention in VS code >> Search for Salesforce CLI Integration >> near Uninstall button there is a drop-down >> Install another version
this error comes from salesforce CLI
./manifest/package.xml
Then you can just run the command whether using cli or visual studio code extension