Search code examples
chocolatey

Permission denied in chocolatey


I have choco installed in my Windows 10 PC. Now, I am trying to install Erlang and Elixir. When I am running the command choco install erlang or choco install elixir, I am getting the following error :

Installing the following packages:
erlang
By installing you accept licenses for the packages.
Progress: Downloading erlang 22.0... 100%
erlang not installed. An error occurred during installation:
 Access to the path 'C:\ProgramData\chocolatey\lib\erlang' is denied.
erlang package files install completed. Performing other installation steps.
The install of erlang was NOT successful.
erlang not installed. An error occurred during installation:
 Access to the path 'C:\ProgramData\chocolatey\lib\erlang' is denied.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - erlang (exited 1) - erlang not installed. An error occurred during installation:
 Access to the path 'C:\ProgramData\chocolatey\lib\erlang' is denied.

From the message it is clear that the file is downloaded successfully, but the installation permission is denied. So what to do to fix this error?


Solution

  • The default installation of Chocolatey installs to the programdata folder. As a result, any usage of Chocolatey needs to happen from an elevated, or administrative, shell.

    If you open an administrative PowerShell or Command prompt window, and re-run the installation command, they should work as expected.

    It is possible to do an an administrative installation of Chocolatey if that is what is required. Check:

    https://chocolatey.org/install

    For more information on options there.