I am in the process of build automation for Salesforce, as a requirement I need to install "Salesforce CLI" and execute few commands. I went through the chocolaty commands, but it doesn't seems to be working, is there any other way around to fix this?
It is possible to install Salesforce cli through command line?
2.4k Views Asked by Abhishek Anvekar At
3
There are 3 best solutions below
0
On
Try to download Node.js via chocolatey:
cinst nodejs.install
and then use npm (gets installed with Node.js) to download the Salesforce-CLI:
npm install --global sfdx-cli
0
On
Install Node JS
curl -sL https://rpm.nodesource.com/setup_11.x | bash -
yum -y install nodejs
npm install -g npm
Install latest sfdx cli
npm install --global sfdx-cli
Install specific version of sfdx cli
npm install --global sfdx-cli@[version]
Uninstall
npm uninstall --global sfdx-cli
You can use normal SFDX CLI installer: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm
If you use Chocolatey and
choco install sfdx-clithrows you some errors - usually the info what to do about the error is right there in the message.choco install sfdx-cli --ignore-checksumsshould work OK.Next error you might get will be about typos in the install script (author of choco package didn't escape spaces properly and it dies on "C:\Program Files", at least on my machine):
We can have a look at what's in the install script, failed installations typically are copied to "lib-bad":
C:\ProgramData\chocolatey\lib-bad\sfdx-cli\toolsI'm not a PowerShell guru but by the look of it it just tries to run
sfdx updateat the end of installation. I can skip the script and run it manually.choco install sfdx-cli --ignore-checksums -nworks OK and then close the console (to reload the PATH variables). Open new console andsfdx updatewill work too.