2

I decided to post this as I am not able to run SFDX CLI on my new work computer.

Please note my computer requires admin rights for each and every modification which obliges me to ask for admin rights each time I need to do a slight modification. Hence Please help me with detailed instructions as I need to first ask for admin rights for each and every step. Here is what i did :

  • I installed VS Code
  • I then installed the Salesforce Extention Pack
  • I tried to run an SFDX command
  • No sfdx command was working
  • I opened CMD and run sfdx --version
  • sfdx --version was not recognized as a command
  • I updated user variables Path in windows with C:\Program files\sf\bin
  • I run sfdx --version again
  • I am now receiving the following error:
C:\Users\balickima>sfdx --version node:internal/modules/cjs/loader:1247 throw err; ^ Error: Cannot find module 'C:\Users\balickima\undefined' at Function._resolveFilename (node:internal/modules/cjs/loader:1244:15) at Function._load (node:internal/modules/cjs/loader:1070:27) at TracingChannel.traceSync (node:diagnostics_channel:322:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5) at node:internal/main/run_main_module:36:49 { code: 'MODULE_NOT_FOUND', requireStack: [] } Node.js v22.13.1 

From now I don't know how to troubleshoot this next. Any help will be much appreciated. Thank you

2
  • 1
    did you tried running sf -v Commented Feb 17 at 9:10
  • As @User6670 mentioned i have tried sf instead sfdx, it worked for me. Commented Mar 7 at 12:29

5 Answers 5

2

As far as I understand, this issue is related to the latest version of the Salesforce CLI. To resolve it, simply run the SF update command in your terminal. Once the CLI is updated, the issue should no longer occur.

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Mar 8 at 17:46
  • running sf update made some things (like fast-switching between orgs using the bottom-most blue menus) start working correctly However, the extension pack is still making invalid commands when right-clicking a file and attempting to Deploy Commented Apr 24 at 19:42
0
  1. Un-install existing node.js
  2. Re-install node.js
  3. Same for VS Code extension, un-install and re-install
  4. After 4th step restart VS Code or machine itself

then you may not get this error. I also face same issue whenever I'm trying this is new machine.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Feb 17 at 10:56
0

Your question is a little confusing. It sounds like you tried to install the VS Code extention pack before installing the Salesforce CLI (sfcli). My guess is this probably would still work, but these are two different tools that require their own install steps.

Also, trying to run the sfdx command should work as an alias for the real binary, which is sf.

The steps for installing the sfcli on Windows are outlined in the Salesforce CLI setup guide. Once installed, there is a troubleshooting section which has a few Windows-specific known issues.

Knowing that you have strict security requirements I might suggest setting up a time with your IT team to have one of them go through the install with you. That way if unexpected items arise related to the hardware security policies placed on your machine, they might be able to help you immediately troubleshoot those. I'd also suggest removing everything you've already installed related to Salesforce tools first, then reboot, then start over.

FYI, if you feel you have everything right and there may be a bug, there is an option to file an issue on github.

0

I had the same issue because I installed the salesforce cli extensions before sf-cli itself. Problem solved by uninstalling and reinstalling them.

-1

Run "sf -v" command instead of "sfdx --version" because new version is supporting sf command.

1
  • while sfdx commands are deprecated, sfdx --version is still a valid command at this point in time. Commented Apr 14 at 16:07

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.