celador / ForceCode

ForceCode is a Visual Studio Code extension for Salesforce development
MIT License
160 stars 69 forks source link

CLI is not working for ForceCode #399

Closed mahendrapalsfdc closed 3 years ago

mahendrapalsfdc commented 3 years ago

I have install CLI in my system and it working as well for sfdx but I install force code then try to create project in force code it;s showing error message CLI is not install.

Please help me to sort it out.

ctinghino commented 3 years ago

Same thing here. The Salesforce Cli is installed because I'm able to run sfdx commands from vscode terminal, but ForceCode always says

image

I already tried uninstalling-reinstalling everything, including Java, configuring Path environment variable, rebooting several times, but nothing worked. This is the console output:

Starting connection service...
Starting Code Coverage Service...
Initializing ForceCode service
Starting ForceCode service
about to run ForceCode.switchUser
{
    errno: -4058,
    code: ENOENT,
    syscall: spawn cmd,
    path: cmd,
    spawnargs: 
    {
        0: /c,
        1: sfdx,
        2: force:org:display,
        3: --targetusername,
        4: sample@example.com,
        5: --json,
    },
}
No parsable results from command "cmd /c sfdx force:org:display --targetusername sample@example.com --json"
ForceCode: The SFDX CLI could not be found. Please download from [https://developer.salesforce.com/tools/sfdxcli](https://developer.salesforce.com/tools/sfdxcli) and install, then restart Visual Studio Code.
Error setting up connection: setupConn

Any ideas? Thanks for the support

gvgramazio commented 3 years ago

Same thing here except for the error number.

macOS Big Surr Version 11.4 (20F71) Visual Studio Code Version 1.58.0 ForceCode Version 3.22.11 sfdx-cli Version 7.109.0

Starting connection service...
Starting Code Coverage Service...
Initializing ForceCode service
Starting ForceCode service
about to run ForceCode.switchUser

{
    errno: -2,
    code: ENOENT,
    syscall: spawn sfdx,
    path: sfdx,
    spawnargs: 
    {
        0: force:org:display,
        1: --targetusername,
        2: sample@example.com,
        3: --json,
    },
}
No parsable results from command "sfdx force:org:display --targetusername sample@example.com --json"
ForceCode: The SFDX CLI could not be found. Please download from [https://developer.salesforce.com/tools/sfdxcli](https://developer.salesforce.com/tools/sfdxcli) and install, then restart Visual Studio Code.
Error setting up connection: setupConn
daishi4u commented 3 years ago

It looks like this issue is when opening a folder by right clicking the folder in Finder/Explorer and choosing Open with VSCode? It looks like an issue with environment variables and how they are set when opening VSCode in this fashion. I would suggest either adding SFDX to your environment variable system wide in windows or your .zprofile for mac until I find another way around the issue. Edit: here is a decent link: https://newbedev.com/set-global-path-environment-variable-in-vs-code

For Mac, if you're using Automator, use this as your script: export PATH=$PATH:/usr/local/bin open -n -b "com.microsoft.VSCode" --args "$*"

Going to close this issue, as it's more of a VSCode problem.

ctinghino commented 3 years ago

@daishi4u it happens always when opening vscode, not only when right-clicking on a folder.

The issue is different from the one you posted: in our case the terminal see sfdx, as well as other extensions, ForceCode is the only one that is not able to see it

alfz86 commented 2 years ago

@ctinghino did you resolve the issue? I have the same problem. I overwrote PATH environment variable by mistake, then I reconfigured it with "C:\Program Files\sfdx\bin" but ForceCode not work anymore. Thanks for the support