I am trying to learn about Salesforce DX (Developer Experience). For most of the salesforce DX tasks, we require using salesforce command line interface such as authorization, creating scratch org. etc. But I am getting this error message:

Error: 'sfdx' is not recognized as an internal or external command, operable program or batch file

How can I fix it?

  • 6
    Sounds like the folder in which you have your executable is not in your PATH environment variable
    – Rob Cowell
    Mar 9 '17 at 14:06

1.Verify the "Salesforce CLI" installed successfully or not

Go to → C:\Program Files\Salesforce CLI\bin → Verify sfdx.exe should be availble

2.Add this path to environment variables "Path" Go To → Windows Search → Edit environment variables for your account enter image description here

  • 1
    And if you're performing this configuration as an administrator to give permissions to a non-administrator user, adding this environment variable to the System variables PATH (in addition to the User variables PATH) may also be needful.
    – Thom B
    Sep 4 '20 at 17:53

It depends on how you installed SFDX. You have multiple options. The easiest one is, as @Pranay said, to access the official build and just install it using the provided installer: https://developer.salesforce.com/tools/sfdxcli

On the other hand, you can also install SFDX as an npm package, if you're used to work with the Node environment: https://www.npmjs.com/package/sfdx-cli

Furthermore, take into account that if you are using Windows with the Linux subsystem installed, you will not be able to access the SFDX CLI from the Bash if you installed it in windows, or the other way around, so you would have to install it in both places, or just where you'll be working.

Once you've installed the CLI remember to also open a new instance of the console (at least in Windows), otherwise it won't recognize the commands.


You need to install Force.com CLI for SFDX. Use the below link. https://developer.salesforce.com/tools/sfdxcli


On mac:

Running the command:

sudo npm install sfdx-cli --global -force

And uninstall and install "Salesforce Extension Pack".

Did the trick for me.


After downloading and installing Salesforce CLI, Goto C:\Program Files\sfdx to verify it is installed. Open CMD as an administrator > type sfdx -v > Press Enter key.

It will show the version installed.



I had the same problem with sfdx recently. What i saw in the terminal when printing the Path variable was that echo %Path% would print the Path variable defined in the System variable section instead of the User variable section. Installing sfdx added 'C:\Program Files\sfdx\bin' to the path in the User variable section.

enter image description here

I added the same thing in the Path variable in the System Variable section and it worked !


For my case the above where not working, because I found that I had multiple sfdx folder due to installation from installer + npm :

  • I had one installed in the following path : C:\Users<>\AppData\Local\sfdx
  • and another one here : C:\Program Files\sfdx

The one installed via npm was at some point in time doing conflict with the other installation. I deleted the folder installed via npm and it works fine now.

Not the answer you're looking for? Browse other questions tagged or ask your own question.