巧克力中的权限被拒绝

时间:2019-07-05 18:57:40

标签: chocolatey

我在Windows 10 PC中安装了choco。现在,我正在尝试安装Erlang和Elixir。当我运行命令choco install erlangchoco install elixir时,出现以下错误:

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.

从该消息很明显,文件已成功下载,但是安装许可被拒绝。那么该如何解决此错误呢?

3 个答案:

答案 0 :(得分:1)

Chocolatey的默认安装安装在programdata文件夹中。因此,对Chocolatey的任何使用都必须在高架或管理的外壳上进行。

如果打开管理性PowerShell或Command提示符窗口,然后重新运行安装命令,它们应该可以正常工作。

如果需要,可以对Chocolatey进行管理安装。检查:

https://chocolatey.org/install

有关该选项的更多信息。

答案 1 :(得分:1)

我们需要以管理员身份打开电源外壳。在Windows中,右键单击以管理员enter image description here身份运行。

答案 2 :(得分:0)

步骤

  1. 首先启用隐藏的 Windows 10 管理员帐户 enter image description here

enter image description here

2.确保您使用的是管理外壳 “在窗口 10 中已经安装了 PowerShell” enter image description here

现在运行“Get-ExecutionPolicy”。如果返回 Restricted,则运行 Set-ExecutionPolicy AllSigned 或 Set-ExecutionPolicy Bypass -Scope Process。

现在运行以下命令(安全问题请查看https://community.chocolatey.org/install.ps1):在命令下面一次性复制

<块引用>

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. 按 Enter。

  2. 等待几秒钟命令完成。

  3. 如果您没有看到任何错误,您就可以使用 Chocolatey 了!输入 choco 或 choco -?现在