Can't get Chocolatey to work: choco keyword throws an error: cannot create directory
Asked Answered
V

2

8

I have just installed Chocolatey (as I think, I'm not familiar with cmd-stuff) to my Windows 10 and I'm getting an error using choco keyword that says:

...Maximum tries of 3 reached. Throwing error. Cannot create directory "C:\ProgramData\chocolatey\config"...

And it says something that the usage of the path "C:\ProgramData\chocolatey\config" is prevented.

When I navigate to the path "C:\ProgramData\chocolatey", "config" directory obviously doesn't exist. What should I do to get the chocolatey to work?

Full error info:

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. Kaikki oikeudet pidätetään.

C:\xampp\htdocs\opettelu\react>cd C:\

C:\>choco install atom
This is try 1/3. Retrying after 300 milliseconds.
 Error converted to warning:
 Polun C:\ProgramData\chocolatey\config käyttäminen on estetty.
This is try 2/3. Retrying after 400 milliseconds.
 Error converted to warning:
 Polun C:\ProgramData\chocolatey\config käyttäminen on estetty.
Maximum tries of 3 reached. Throwing error.
Cannot create directory "C:\ProgramData\chocolatey\config". Error was:
System.UnauthorizedAccessException: Polun C:\ProgramData\chocolatey\config käyttäminen on estetty.
   kohteessa System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   kohteessa System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   kohteessa System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   kohteessa chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass60.<create_directory>b__5f()
   kohteessa chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1.<retry>b__0()
   kohteessa chocolatey.infrastructure.tolerance.FaultTolerance.retry[T](Int32 numberOfTries, Func`1 function, Int32 waitDurationMilliseconds, Int32 increaseRetryByMilliseconds, Boolean isSilent)
   kohteessa chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory(String directoryPath)
   kohteessa chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory_if_not_exists(String directoryPath, Boolean ignoreError)
Polun C:\ProgramData\chocolatey\config käyttäminen on estetty.

C:\>

Thanks.

Valorous answered 6/10, 2016 at 17:37 Comment(0)
A
11

Run Chocolatey from an administrative command prompt - you are running into UAC issues. The first time Chocolatey runs, it needs to create the config file. Some commands you won't need administrative command prompt to have, but the first time it is particularly required.

The reason the install process doesn't run it once to create those things is that .NET Framework 4.x may have just been installed and require a reboot prior to using choco.exe. In those instances it would have a modal dialog pop up mentioning the issue and required reboot, which is unacceptable for automation purposes.

Antre answered 6/10, 2016 at 19:42 Comment(0)
H
2

Run the command as administrator enter image description here

Hildegaard answered 21/7, 2020 at 8:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.