10

In VS Code. Go to command palette and enter 'Create Project with Manifest'. Prompted for a folder and get these messages:

Starting SFDX: Create Project

sfdx force:project:create --projectname DeanSand --outputdir c:\Users\dean.wooldridge\Documents\Salesforce\Dean Notes\VSCode\DeanSand --manifest

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

sfdx force:project:create --projectname DeanSand --outputdir c:\Users\dean.wooldridge\Documents\Salesforce\Dean Notes\VSCode\DeanSand --manifest

ended with error spawn sfdx ENOENT
The Salesforce CLI is not installed. Install it from https://developer.salesforce.com/tools/sfdxcli

I promise it is installed - did it yesterday and had to have IT come over and temporarily grant admin access to do it.

5
  • 2
    Sounds like SFDX is installed in a location that is not in your PATH. Are you using Git Bash/MinGW/Windows Subsystem for Linux, or cmd.exe? Have you tried to configure your PATH?
    – David Reed
    Nov 9, 2018 at 20:55
  • If you open a command prompt and type echo %PATH%, what happens? (Looks like you're probably using cmd.exe)
    – David Reed
    Nov 9, 2018 at 20:59
  • Actually that appears to be an excellent guess. It is stored in: c:\Program Files\Salesforce CLI\bin and that is not in the path. So I go to that subdirectory and try 'sfdx --version' and get 'sfdx-cli/6.38.0-0d66175ccf (windows-x64) node-v8.9.4'. So I guess it is installed. Added the sub-directory to the PATH and still no joy - same error. I try the project create manually by pasting the command into a CMD window and get 'Unexpected argument'. What a pain. Nov 9, 2018 at 21:08
  • Put quotes around the --outputdir argument and got it to run. Still manually not from VS Code. Nov 9, 2018 at 21:14
  • getting same issue mind you sfdx working in separate cmd prompt ,its only not working with VS code...i also added sfdx directory in PATH variable ![enter image description here](i.stack.imgur.com/53qOL.png) Dec 20, 2018 at 1:42

8 Answers 8

11

There appear to be two separate issues here:

  1. SFDX must be in your PATH environment variable. That is, the full path of the bin subdirectory where the sfdx executable lives. You'll likely need to relaunch your terminal and/or Visual Studio Code to get them to observe any changes you've made to your Windows PATH.
  2. You need to quote any file and directory path names that contain spaces when you're manually invoking SFDX (or any other command line tools) in the shell. Note that some tools don't handle spaces well anyway - you may head off issues with other software if you try to avoid spaces in your paths.
5

You need to add SFDX location to the System Path Variable (not your own variables). open Environment Variables and set the path in the System Variables section as highlighted below:

Windows Envirnoment Variables

0

I faced the same issue recently. Salesforce extension pack was auto-updated and there was a "Reload Required" button next to extension. I just refreshed vscode using the button and the problem went away.

0

I selected "PATH" when I installed this and had the same issue. Make sure it is in your System Profile and not your User Profile. This fixed it for me.

0

Copy the path of the folder where "sfdx.cmd" file exists, ex: "C:\Program Files\Salesforce CLI\bin"

Go to Environment Variables and paste the value and add new value in the "path" variable. Restart all the open command line and visual studio instances.

now try to create project with Manifest from command palette.

0

If it is showing that CLI is not installed, then the possible is you haven't set the path or set the wrong path.

To set PATH:

  1. Press Start Button
  2. Type Environment
  3. Go to System Environment setting
  4. Go to Advanced
  5. Environment Variables - there are two options: user variable for admin and system variables
  6. Go to system variables
  7. Double click on Path
  8. Add new row and paste the path of Salesforce CLI, in my case it is "C:\Program Files (x86)\Salesforce CLI\bin"
  9. Also set the path of Java JDK if it is not set. In my case path of java is "C:\Program Files (x86)\Java\jdk-13.0.1\bin"
  10. Now click OK, again OK and now you are done
  11. To check that your path is set type "win+R" type "CMD" and enter " echo %PATh% ". If you find your new path here then your path is successfully set

Tip - if still not showing path try restarting the system.

0

That solved my problem with those steps I was getting the same message: Salesforce CLI is not installed when running the sfdx authorize org command, but when running the sfdx create class, it was working, which doesn't make sense. I realized that I had installed the visual studio code x86 version. I uninstall the x86 version and installed the right 64bit version and everything works properly now. 1)Go to the site: https://code.visualstudio.com/Download# 2) Download the 64bit version Visual studio code version

-1

I could solve this issue by putting quotes around in the PATH environemnt variable values for Salesforce CLI and VS Code. So my PATH value for these 2 is currently : "C:\Program Files\Salesforce CLI\bin";"C:\Users\Consultant\AppData\Local\Programs\Microsoft VS Code\bin"; We need these quotes because both these 2 directory paths have spaces in their folder names

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .