function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
EdCodeEdCode 

Have installed Salesforce CLI before Visual Studio Code + Salesforce Extensions

Hello,
I am trying to learn about SFDX and have installed Visual Studio Code + Salesforce Extensions.
I skiped the step that says "Make sure you have the latest version of the Salesforce CLI installed, and that your system meets the necessary requirements." because, before installing VS Code + the SF Extensions, I reviewed the list of extensions includeded in SF Extensions and saw that it included CLI.
It was a confusion moment and... I think I also read out there that it was better to installed CLI as part of SF Extension (which includes a set of extensions).

Eventually, because I was not able to create new Project from VS Code (Ctrl+Shift+P), I decided to revisite the steps to set up SF DX with VS Code, and decided to intall SF CLI by downloading a file (win64) from here (https://developer.salesforce.com/tools/sfdxcli ) and execute installation of that file.

Right now, my laptop has the following installed:
- Visual Studio Code + Salesforce Extensions (look at screenshot below)
- Salesforce CLI (win64) dowloaded from the above link

User-added image

How can I verify if Salesforce CLI works fine? I have tried executing cmd.exe the following command: sfdx --version
... but I am getting this error message:
User-added image

Do you think that the fact that I installed SF CLI after installing VS Code is the reason for the above command line not being recognized?

How can I make sure that I have all the SFDX tools correctly installed?

Thank you very much.

 
Best Answer chosen by EdCode
EdCodeEdCode
Look at the solution here: https://developer.salesforce.com/forums/ForumsMain?id=9062I000000QvJJQA0

All Answers

muenzpraegermuenzpraeger
Can you re-install the CLI? The VS Code extensions rely on the CLI being installed (that's the "Salesforce CLI integration" extension).

The command "sfdx --version" is the correct one to verify that.
EdCodeEdCode
Hello Muenzpraeger,

I can re-install the CLI but that is the last thing I have done.

After re-installing the CLI, should I also re-install the Salesforce Extensions in VS Code?

Thank you very much
EdCodeEdCode
I am re-installing the Salesforce CLI, and this time, during the installation process, when the installer asks me for a path, I provide this path C:\Program Files (x86)

(instead of C:\Program Files)

Perhaps this was the reason. I will let you know if it works after the re-install process is finished.

Thank you.
EdCodeEdCode
Re-Installing the Salesforce CLI did not resolve the issue.
User-added image

Any other idea?

Thank you very much.
Ankush02Ankush02
Hey,

Please refer to the below link.

https://salesforce.stackexchange.com/questions/167120/sfdx-command-not-found-salesforce-dx/191974

Copy the Path  "C:\Program Files\sfdx\bin" and paste it into System Environment Variable. Also, you can check if there is an executable at that location. If that is the case then just adding the bin path should actually work.
EdCodeEdCode
Hello Ankush,
Thank you. I think your advice to add a path on the System Environment Variables of Windows is probably the correct direction to resolve the issue.

However, I observe that this path (C:\Program Files\sfdx\bin) does not really exist as such in my laptop. Instead I have these 2 existing paths now:
C:\Program Files\Salesforce CLI\bin
C:\Program Files (x86)\Salesforce CLI\bin

That is because I installed twice Salesforce CLI, one in each subdirectory (to try if that was the issue) but, I am not sure why your URL includes the folder "sfdx" while my URLs include the folder "Salesforce CLI" instead (?)

Anyways, I have added your suggested path to Windows' System Environment Variables --> it did not work.
Then, I have tried C:\Program Files\Salesforce CLI\bin --> it does not work.
And then, C:\Program Files (x86)\Salesforce CLI\bin --> it does not work either.

Any idea of what the issue could be?

Thank you very much.
Ankush02Ankush02
Hi ,

 I think it is just the folder name. I have the below location in the path:

C:\Program Files\Salesforce CLI\bin

This works for me. You can try the following
  • Uninstall the sfdx from Program Files (x86) location
  • Try adding the path  "C:\Program Files\Salesforce CLI\bin" to the User Variables and not the System Variables.
This should probably work. I have the same configuration.

Regards,
Ankush



 
EdCodeEdCode
Hi Ankush,

I have tried exactly what you have suggested:
  1. Uninstalling the CLI from Program Files (x86) location;
  2. I have added the path C:\Program Files\Salesforce CLI\   to the "User Variables" (not the system variables);
But, that is not resolving it.

In order to do the above 2 steps, I have had to log as a System Admin of Windows 10 (this is a laptop of a company).
Then, I have tried from that System Admin user AND from my regular user to execute the command "sfdx --version" from cmd and it just returned the same error (sfdc is not recognized....)

I wonder if, when adding the additional path to the User Variable, I may have to specify the User name I want this to work with (?) I do not now how to specify the User on this path C:\Program Files\Salesforce CLI\ 

I am continuing to investigate as I have not been able to solve it so far.

Thank you very much.


 
EdCodeEdCode
One more piece of information:

With my regular user (the non-System Admin), I have now been able to verify that the path C:\Program Files\Salesforce CLI\bin is added/visible on the list of User Variables.

I have rebooted my machine and have logged again with my regular user and tried again the command in cmd:
sfdx --version
...but got the same reply by cmd: sfdx is not recognized...

So, I am not sure what else to try now.

Any idea?
Connor CainConnor Cain
hello everyone,
I had the same problem and found the solution. Salesforce CLI creates a User Variable when installed but Windows 10 does not allow spaces in the PATH which makes it fail to work. to fix I copied the whole file over to another Directory called Tools and renamed the file "Salesforce CLI" to remove the space > "SalesforceCLI". then added a new PATH looking at this new Directory C:\Tools\SalesforceCLI\bin which allowed the cmd to be global. 
All credit goes to this post: 
https://salesforce.stackexchange.com/questions/221950/salesforce-cli-tools-do-not-work-together-with-git-bash-on-windows
 
EdCodeEdCode
I found the solution:

I just had to rename the name of the Environment variable to Path (replacing the name that was created automatically when installing Salesforce CLI).

I now works perfectly.
EdCodeEdCode
Look at the solution here: https://developer.salesforce.com/forums/ForumsMain?id=9062I000000QvJJQA0
This was selected as the best answer
Pravudatta MohantyPravudatta Mohanty
in npm\node_modules\sfdx-cli\bin folder, rename run.cmd to sfdx.cmd