3

When there are bugs in different versions of SFDX CLI and the Plugins: There is a need to switch to another version. But I find uninstalling and re-installing too time consuming. Often people post fixes that refer to a version I am not using, and I wish to give that version a try.

I want to know what is the best way to setup my VSCode and install SalesforceDX and SF CLI etc so that if an issue is introduced into the latest version I am using, I can easily switch to and older version to complete a task and then switch back to the new or different version to continue on?

Options I am looking at, are:

  • Based on the Windows downloaded installation: Once installed I want to easily version switch and how is it best to do this? Is it by uninstalling or using a contextual menu to version switch?
  • Node Installation. Once installed I want to easily version switch and how is it best to do this? Is it by using node commands to version switch or to use the contextual menu to version switch?
  • Happy to receive answers pertaining to MAC or Linux, but my build is currently Windows.
  • Maybe there is a generic solution for all OSes?

NB: I have noted that when I install with Node using "SFDX update" no longer updates I get a message telling me to use a Node command to update "npm update --global sfdx-cli"


Issues I am experiencing but are not what I am asking about they are for CONTEXT ONLY:

  • SF CLI is not authenticating, so I want to adjust the version i am using to enable the auth until the fix comes out.
  • Retrieving metadata, deploying metadata has inconsistent issues various metadata are landing in the wrong folders.
  • Was using version 7.89.2. - I upgraded to 7.90.2 and auth issues went away.
3

I suggest using the NPM to install and upgrade for ease of switching between versions.

With this approach, your CLI is not auto upgraded and it is upon you to upgrade by watching the npm registry and reading release notes here.

NPM is a package manager for Node.js. You will need to have Node.js latest version installed along with NPM.

Install Current Stable Version

npm install --global sfdx-cli

This is the version that will be most stable and recommended. It is released every week Thursday! It is also possible sometimes if there is a critical bug there is an immediate release (most unlikely)

Get a version that is ahead of Stable Verison

npm install sfdx-cli@latest-rc

This version is ahead of the stable version and may have potential bugs that went undiscovered. This is also released weekly on Thursday. Salesforce CLI team recommends you have a branch in your continuous integration with this version so that any potential bugs are caught and informed to the team before this is released as stable.

You can switch to the latest stable version from release candidate simply by doing npm install sfdx-cli@latest

Install a specific version

npm install --global sfdx-cli@<version>

You can obtain the version number from here

example npm install --global sfdx-cli@7.90.1

Uninstall

At any point you want to uninstall the CLI, you can do using below

npm uninstall sfdx-cli --global

The other thing to note is Salesforce CLI is made of a number of core plugins.

If you wish to update one of those, say an example salesforcedx plugin then the command is below

sfdx plugins:install salesforcedx@latest-rc

I highly recommend not to individually try to change versions of these plugins unless you know what you are doing.

Salesforce CLI team published a detailed blog post around the progress around Open sourcing Salesforce CLI.I suggest giving a read

Also, most of the code is Open Source here so you can see the progress and monitor changes.

7
  • Thanks Mohith! I also noted this in the most recent release notes:"If you installed the pre-release version of the salesforcedx plug-in, uninstall it and update the CLI. We’re no longer updating the pre-release and will be removing the tag." – NZ Dev Mar 5 at 2:27
  • @NZDev Please check my enhancements on plugins: install command for plugins that ship along. I highly recommend do not individually try to manage them! – Mohith Shrivastava Mar 5 at 2:29
  • Sorry can you go into a little more detail, not sure I fully understand what you are advising. – NZ Dev Mar 5 at 4:34
  • 1
    Yes so don't try to change salesforcedx plugin versions using sfdx plugins: install salesforcedx@50.1.0! – Mohith Shrivastava Mar 5 at 5:07
  • 1
    Yes exactly don't do that because that way when you update via npm it will overwrite so no point – Mohith Shrivastava Mar 5 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.