[SalesForce] ERROR running force:source:deploy: InvalidPackageDirectory

Facing below issue in Jenkins Deployment from yesterday(It was working fine till yesterday). Can you please suggest a solution to resolve this issue?

  • sfdx force:source:deploy -p ./deploy-sf -l NoTestRun –verbose –loglevel fatal -u testdeploymentusername@test.com

› Warning: sfdx-cli update available from 7.78.1 to 7.80.0.

Using specified username testdeploymentusername@test.com

ERROR running force:source:deploy: InvalidPackageDirectory

script returned exit code 1

The sfdx-project.json looks like:

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    },
    {
      "path": "deploy-sf",
      "default": false
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "login.salesforce.com",
  "sourceApiVersion": "47.0"
}

Best Answer

I just got the same error and was puzzled myself as to why it stopped working all of a sudden when I haven't changed the sfdx-project.json at all. It turned out that I deleted one of the folders mentioned in the packageDirectories.

I'm assuming the same happened to you and you deleted the deploy-sf folder without removing it from the sfdx-project.json file.

Related Topic