Reputation: 418
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?
Upvotes: 1
Views: 3285
Reputation: 1
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
Upvotes: 0
Reputation: 381
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
Upvotes: 0
Reputation: 19637
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-cli
throws you some errors - usually the info what to do about the error is right there in the message.
Error - hashes do not match. Actual value was '947036CB8228616B0C9A94B9F11FD43225188C1839A7475930288CA650B78361'. ERROR: Checksum for 'C:\Users[redacted]\AppData\Local\Temp\chocolatey\sfdx-cli\6.0.16\sfdx-windows-amd64.exe' did not meet '9C33344AED91F6CC2CF97A64A69D99CBAD9EBBF4A28920B8160CDFCE83772326' for checksum type 'sha256'. Consider passing the actual checksums through with --checksum --checksum64 once you validate the checksums are appropriate. A less secure option is to pass --ignore-checksums if necessary. The install of sfdx-cli was NOT successful.
choco install sfdx-cli --ignore-checksums
should 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):
'C:\Program' is not recognized as an internal or external command, operable program or batch file. ERROR: Running ["cmd" /C "C:\Program Files\sfdx\bin\sfdx.exe" update] was not successful. Exit code was '1'. See log for possible error
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\tools
I'm not a PowerShell guru but by the look of it it just tries to run sfdx update
at the end of installation. I can skip the script and run it manually.
choco install sfdx-cli --ignore-checksums -n
works OK
and then close the console (to reload the PATH variables). Open new console and
sfdx update
will work too.
sfdx-cli: Updating CLI... already on latest version: 7.54.4-8ff9ba9cc5
Upvotes: 0