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."
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
- Set the step working directory to where
sfdx-project.jsonlives. - Confirm the file is present after checkout.
- Re-run the command from that directory.
- name: Deploy
working-directory: ./salesforce-app
run: sf project deploy start --target-org ci-orgEnsure 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.