巧克力中的权限被拒绝

Permission denied in 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.

从消息中可以看出文件下载成功,但安装权限被拒绝。那么如何解决这个错误呢?

Chocolatey 的默认安装安装到 programdata 文件夹。因此,Chocolatey 的任何使用都需要从提升的或管理的 shell.

进行

如果您打开管理 PowerShell 或命令提示符 window 和 re-run 安装命令,它们应该会按预期工作。

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

https://chocolatey.org/install

有关此处选项的更多信息。

我们需要以管理员身份打开电源-shell。在 windows 中,以管理员身份 运行 右键单击​​

步骤

  1. 首先启用隐藏的Windows10个管理员账号

2.ensure 您正在使用管理 shell “在 window 10 PowerShell 中已安装”

现在 运行“Get-ExecutionPolicy”。如果它 returns 受限,则 运行 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. 按回车键。

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

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