Permission denied in chocolatey
Asked Answered
A

5

7

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?

Aldora answered 5/7, 2019 at 18:57 Comment(2)
Are you running Chocolatey from an administrative shell? If not, that is likely why you are seeing those errors.Skirl
Thanks a lot. I have opened Command prompt as administrator and the installations continued without any error.Aldora
S
6

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.

Skirl answered 6/7, 2019 at 9:7 Comment(0)
M
24

We need to open the power-shell as Admin. In windows right click run as Administrator enter image description here.

Megargee answered 15/5, 2020 at 20:10 Comment(1)
Or we can make the shortcut always run as an adminTerribly
S
6

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.

Skirl answered 6/7, 2019 at 9:7 Comment(0)
A
2

Steps

  1. First enable the hidden Windows 10 administrator account enter image description here

enter image description here

2.ensure that you are using an administrative shell "In window 10 PowerShell already installed" enter image description here

Now Run "Get-ExecutionPolicy". If it returns Restricted, then run Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass -Scope Process.

Now run the following command (security concerns kindly review https://community.chocolatey.org/install.ps1): copy in one time below command

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'))

  1. Press Enter.

  2. Wait a few seconds for the command to complete.

  3. If you don't see any errors, you are ready to use Chocolatey! Type choco or choco -? now

Aftereffect answered 3/4, 2021 at 2:54 Comment(0)
S
0

Before running cmd / powershell Click run as administrator

Submediant answered 13/6, 2022 at 22:5 Comment(0)
W
0

I got this error even after running as administrator, so tried giving folder rights to "everyone" and it worked.

Westberry answered 22/1, 2023 at 8:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.