forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
494 stars 78 forks source link

cli can't find node.exe when running from an exec context on windows #1756

Closed socialsuiteDavid closed 2 years ago

socialsuiteDavid commented 2 years ago

Summary

If you run an sfdx command from an exec context in windowsthen the sfdx command will fail with the error: ...\Salesforce CLI\bin\node.exe"' is not recognized as an internal or external command,

Steps To Reproduce:

(note only on windows, mac does not have the issue) In my case I encountered this while writing a plugin for sfdx. I noticed that the linked plugin from the Salesforce docs also shows this problem.

Repository to reproduce: shane-sfdx-plugins

  1. sfdx plugins:install shane-sfdx-plugins
  2. sfdx shane:org:create --userprefix asdf -o asdf@e.com -a testshane --json

Expected result

sfdx command should run from child_process#exec

Actual result

error looking for node in the wrong folder: ...\Salesforce CLI\bin\node.exe"' is not recognized as an internal or external command,

System Information

terminal: cmd.exe

sfdx version info

{ "cliVersion": "sfdx-cli/7.172.0", "architecture": "win32-x64", "nodeVersion": "node-v16.17.1", "pluginVersions": [ "@mshanemc/plugin-streaming 1.1.7 (user)", "@mshanemc/sfdx-sosl 1.1.0 (user)", "@oclif/plugin-autocomplete 1.3.1 (core)", "@oclif/plugin-commands 2.2.0 (core)", "@oclif/plugin-help 5.1.14 (core)", "@oclif/plugin-not-found 2.3.3 (core)", "@oclif/plugin-plugins 2.1.1 (core)", "@oclif/plugin-update 3.0.2 (core)", "@oclif/plugin-version 1.1.2 (core)", "@oclif/plugin-warn-if-update-available 2.0.6 (core)", "@oclif/plugin-which 2.1.0 (core)", "@salesforce/analytics 1.0.10 (user)", "alias 2.1.5 (core)", "apex 1.2.0 (core)", "auth 2.2.13 (core)", "community 2.0.3 (core)", "config 1.4.21 (core)", "custom-metadata 2.0.1 (core)", "data 2.1.4 (core)", "generator 2.0.5 (core)", "info 2.1.9 (core)", "limits 2.0.5 (core)", "org 2.2.7 (core)", "packaging 1.9.4 (core)", "schema 2.1.10 (core)", "signups 1.2.7 (core)", "source 2.0.17 (core)", "telemetry 2.0.2 (core)", "templates 55.1.0 (core)", "trust 2.0.4 (core)", "user 2.1.10 (core)", "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)", "@salesforce/sfdx-scanner 2.13.9 (user)", "salesforce-alm 54.8.1 (core)", "shane-sfdx-plugins 4.43.0 (user)", ], "osVersion": "Windows_NT 10.0.19043", "shell": "cmd.exe", "rootPath": "C:\Users\David\AppData\Local\sfdx\client\7.172.0-1aa6bdf" }

github-actions[bot] commented 2 years ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

socialsuiteDavid commented 2 years ago

Note that a reinstall of sfdx cli seems to have fixed the issue, so perhaps it was an issue caused by updating sfdx cli through the versions.