forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
944 stars 400 forks source link

VSCode gives me error "Salesforce CLI is not installed" #5340

Closed Rachel-Aki closed 5 months ago

Rachel-Aki commented 6 months ago

Summary

VSCode gives me error "Salesforce CLI is not installed"

but i already install it:

sfdx --version

@salesforce/cli/2.12.9 darwin-x64 node-v16.13.1

I was able to successfully execute the command in the terminal,but i can't find these command in vscode。

Steps To Reproduce:

  1. install Salesforce CLI 2.12.9
  2. install Salesforce Extension Pack

Expected result

I can use quick command in vscode

Actual result

VSCode gives me error "Salesforce CLI is not installed"

Salesforce Extension Version in VS Code:v59.13.0

SFDX CLI Version:2.12.9

peternhale commented 6 months ago

@Rachel-Aki Using the embedded terminal window in vscode run sf --version and share the results. If the results are command not found restart vsocde and try again.

leefranke commented 6 months ago

I had the exact same problem this morning. This is right after a Windows 10 Update.

The solution was to add the path to java bin to the PATH in my computer's environmental settings. For me it was C:\Program Files\Zulu\zulu-17\bin

Now the issue is the links to 'Run Test' & 'Run All Tests' are missing on all my Test Classes.

Hope this helps,

lee

peternhale commented 6 months ago

@leefranke do you see any Salesforce extensions when you run Show Running Extensions?

emilybishop2 commented 6 months ago

I am having a similar issue except the error that is popping up is "Your installed Salesforce CLI version is no longer supported". And the extension is stuck in Activating. If I install the extension version 59.9.0, everything works as expected

CLI version is @salesforce/cli/2.23.20 win32-x64 node-v21.1.0

Running Extensions Screenshot

Rachel-Aki commented 6 months ago

ound restart vsocde and try again.

The result is : @salesforce/cli/2.12.9 darwin-x64 node-v16.13.1 restart Vscode is not work for me

peternhale commented 6 months ago

@emilybishop2 @leefranke could I ask that you run the following and share the results.

In a command prompt run where sf

if it returns INFO: Could not find files for the given pattern(s). the directory where sf is installed is not on the current path

If it returns a valid path, then

@Rachel-Aki would you also try the same, but use command which instead of where.

emilybishop2 commented 6 months ago

Running where sf in command prompt: C:\Users\12001005242768\AppData\Roaming\npm\sf C:\Users\12001005242768\AppData\Roaming\npm\sf.cmd

I cannot run sf --version in command prompt because it's blocked by group policy. I have to run everything in git bash. I would assume this isn't related to the issue because I would probably be getting an error that CLI is not installed, rather than that it is outdated.

Running sf --version in Git Bash: @salesforce/cli/2.23.20 win32-x64 node-v21.1.0

Running where sf in VS Code: C:\Users\12001005242768\AppData\Roaming\npm\sf C:\Users\12001005242768\AppData\Roaming\npm\sf.cmd

peternhale commented 6 months ago

@emilybishop2 I believe the group policy is exactly what is causing the error. When we are checking the version of sf in the extension we are forking a process and it is using what ever the default shell might be on your machine. So it sounds like the call out to check version is failing.

peternhale commented 6 months ago

@emilybishop2 is your env var ComSpec set?

emilybishop2 commented 6 months ago

@peternhale yes, it's set to C:\windows\system32\cmd.exe

peternhale commented 6 months ago

@emilybishop2 thank you. I was wondering how you configure vscode terminal to run with git bash?

peternhale commented 6 months ago

We have yet to narrow down these issues, so we recommend downgrading to v59.12.0 for those individuals experiencing the issues related to CLI verification.

We will be working on a fix once the cause(s) have been identified.

emilybishop2 commented 6 months ago

@peternhale I'm pretty sure all I have to do is set the default terminal in my user settings. And I think have the path to Git in the environment path

"terminal.integrated.defaultProfile.windows": "Git Bash"

CristiCanizales commented 5 months ago

Closing this issue as the feature that generated it was reverted.