1

Getting below error when I Retrieve or Deploy any component in my VS Code -

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

Retrieve/Deploy are working fine by using below commands from Terminal -

sfdx force:source:retrieve --sourcepath .\force-app\main\default\lwc\helloWorld
sfdx force:source:retrieve --sourcepath .\force-app\main\default\lwc\helloWorld

I think the problem started after an update in VS Code extensions "Salesforce CLI Integration" or/and "Salesforce Extension Pack", however I revert the previous version still not able to resolve.

Below is my sfdx-project.json

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "56.0"
}

I appreciate for any help, thank you.

7
  • are you working behind a company proxy? Commented Oct 6, 2023 at 7:59
  • could you please explain what do you mean by that? Commented Oct 6, 2023 at 8:10
  • Is this your company org and do you use VPN to do your work? Commented Oct 6, 2023 at 8:17
  • I am not using VPN. Commented Oct 8, 2023 at 5:55
  • I had the same issue but running the below command from the terminal worked for me. sfdx force:source:deploy -p force-app/main/default - developer.salesforce.com/forums/?id=9062I000000IFKyQAO Commented Oct 12, 2023 at 6:44

1 Answer 1

1

When I recently had this issue I realised it was because the manifest file wasn't being recognised as the manifest but as plain XML instead. In VSCode you can change this in the bottom right of the window when the manifest file is in focus i.e. it'll say XML instead of ForceSourceManifest. Click on XML and change it to the correct value.

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.