Salesforce CLI execution fails for NPM-based install on Windows when there's no project context

Issue #2422 resolved
Scott Wells repo owner created an issue

I heard about this from an end user who installed the v2 CLI on Windows using NPM. It’s even reproducible (for the user) from the command-line when a command is executed as follows:

C:\Users\<username>\AppData\Roaming\npm> C:/Users/<username>/AppData/Roaming/npm/sfdx.cmd force:org:display -u <redacted> --json
The system cannot find the path specified.

I uninstalled my package-based Windows CLI install and installed from NPM, but I don’t see the same issue:

2023-09-06 11:56:32,182 [  88531]   FINE - #com.illuminatedcloud.util.CommandLineUtil - Running command line: 'C:/Users/Scott/AppData/Roaming/npm/sfdx.cmd force:org:display -u <redacted> --json' from working directory: 'C:\Users\Scott\AppData\Roaming\npm'.
...
2023-09-06 11:56:37,198 [  93547]   FINE - #com.illuminatedcloud.util.CommandLineUtil - Returning command-line response: CommandLineResponse{exitCode=0, output='{...}', duration=5016}

However, I’ve made a change to the way that IC2 selects a working directory for executed CLI processes to try to use the user home directory before ultimately degrading to the CLI script’s parent directory. I’m hoping that will resolve this issue.

Comments (2)

  1. Scott Wells reporter

    Here's a test build that includes the change to use the user home directory before the script parent directory. Otherwise it's the same as the current official build. To install it, download the archive (but don't extract it) and use Settings / Preferences | Plugins | Install plugin from disk (under the gear drop-down menu). Restart the IDE and see whether the same problem is reproducible. Either way please provide a new debug log showing the execution of the force:org:display command that was previously failing.

  2. Log in to comment