Downgrading sfdx-cli

I’m wondering whether it’s possible to downgrade sfdx-cli to use an earlier version? I’m trying to debug an issue with using it in pipeline scripts. When I run sfdx version --core I get sfdx-cli 7.28.7 (core) .

If I run
sfdx version I get sfdx-cli/7.28.7-7bceba6f24 darwin-x64 node-v10.15.3 .

If I do cat package.json inside the actual package dir for sfdx-cli after doing npm install sfdx-cli@7.26.0 I get "sfdx-cli": "^7.26.0"

Why does it then show that the version is 7.28.7? How can I force the lower version to have preference? I do understand that this question is not really salesforce specific but hopefully someone has run into the same problem.


Updated answer (thanks to Shane McLaughlin’s answer, please upvote their answer as well):

It depends how you installed the CLI originally. If you installed via npm, lie npm install -g sfdx-cli then you can use npm to install whatever version you like, ex: npm install -g sfdx-cli@7.109.0

If you installed via the installer (downloading a tarball, pkg, windows installer, etc) then you don’t have an easy downgrade path without uninstalling the CLI first (it’s not hard, it won’t lose all your orgs).

Then you can install an older version (and turn off auto-update if you want to stay on the older version).

Original Answer (outdated)

You can change to any version you want by using the @version notation:

sfdx plugins:install sfdx-cli@7.26.0

(Or any other version).

Note that ordinarily there is some “gap” between the various version parts, and is not likely the issue. Normally, you’d upgrade/downgrade the entire salesforcedx package:

sfdx plugins:install salesforcedx@latest


sfdx plugins:install salesforcedx@46.16.0

As a quick fix, I recommend:

sfdx update
sfdx plugins:update

This should ensure that all plugins are up to date.


sfdx salesforcedx@latest

Also, you might be having some conflicts because, apparently, you wouldn’t normally have both sfdx-cli and salesforcedx installed at the same time (you should be using the latter). DX works just fine on my computer without sfdx-cli installed. Here’s what my config looks like, for reference:

$ sfdx plugins --core
@oclif/plugin-commands 1.2.2 (core)
@oclif/plugin-help 2.1.6 (core)
@oclif/plugin-not-found 1.2.2 (core)
@oclif/plugin-plugins 1.7.8 (core)
@oclif/plugin-update 1.3.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.0.2 (core)
analytics 1.1.2 (core)
generator 1.1.0 (core)
mo-dx-plugin 0.2.5
salesforcedx 46.16.0
├─ force-language-services 46.23.0
└─ salesforce-alm 46.21.0

Source : Link , Question Author : akarnid , Answer Author : sfdcfox

Leave a Comment