Skip to content
Latchkey

Salesforce CLI "ENOENT: sfdx-project.json" not found in CI

Project-aware commands read sfdx-project.json from the working directory or a parent. When it is not found, the CLI reports an ENOENT for that file or "This command is required to run from within a Salesforce DX project", meaning the step ran in the wrong directory.

What this error means

A command fails with "ENOENT: no such file or directory, open '.../sfdx-project.json'" or "This command is required to run from within a Salesforce DX project."

sf
Error (1): This command is required to run from within a Salesforce DX project.
ENOENT: no such file or directory, open 'sfdx-project.json'

Common causes

The step runs outside the project root

The job changed directory, used a wrong working-directory, or checked out into a subfolder, so no sfdx-project.json is visible.

The repository checkout is incomplete

A sparse or partial checkout that omitted sfdx-project.json leaves the CLI with no project to anchor to.

How to fix it

Run from the project root

  1. Set the step working directory to where sfdx-project.json lives.
  2. Confirm the file is present after checkout.
  3. Re-run the command from that directory.
.github/workflows/ci.yml
- name: Deploy
  working-directory: ./salesforce-app
  run: sf project deploy start --target-org ci-org

Ensure a complete checkout

Make sure the checkout includes the project root and sfdx-project.json, not just a subset of paths.

How to prevent it

  • Run Salesforce CLI commands from the directory holding sfdx-project.json.
  • Verify the file exists in CI before invoking project commands.
  • Avoid sparse checkouts that drop the project manifest.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →