'choco' not recognized, but chocolatey is installed

Viewed 72

Tried to install chocolatey on my windows machine, got back some errors that I, unfortunately, don't have. When I tried the installation process again, I got back an error that chocolatey was already installed. So I tried to execute a choco command but it was not recognized:

PS C:\WINDOWS\system32> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
WARNING: Files from a previous installation of Chocolatey were found at 'C:\ProgramData\chocolatey'.
WARNING: An existing Chocolatey installation was detected. Installation will not continue.
For security reasons, this script will not overwrite existing installations.

Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself.
PS C:\WINDOWS\system32> choco upgrade chocolatey
choco : The term 'choco' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ choco upgrade chocolatey
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (choco:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
2 Answers

The important part in the output that you have shown is this part...

WARNING: Files from a previous installation of Chocolatey were found at 'C:\ProgramData\chocolatey'.

WARNING: An existing Chocolatey installation was detected. Installation will not continue. For security reasons, this script will not overwrite existing installations.

During installation, Chocolatey modifies the permissions on the installation folder for security purposes. It can't do this effectively if the installation folder already exists, therefore the installation will halt and not continue.

If Chocolatey is indeed not installed, and the suggestion from @mklement0 didn't help, then the suggestion would be to delete the C:\ProgramData\chocolatey folder, and then run the installation script again.

You mentioned that during the original installation attempt that there were errors, but you also didn't mention what those errors were. Can you provide more information about what you were seeing, and perhaps we can provide assistance.

Delete the chocolatey from C:\ProgramData\chocolatey and try again. That will work !

Related