Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

chocolatey

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.

like image 448
Lazy Avatar asked Oct 06 '16 17:10

Lazy


People also ask

How do you check if Choco is installed?

To verify that Chocolatey is installed, we will use the choco command. C:\WINDOWS\system32>choco Chocolatey v0. 10.15 Please run 'choco -? ' or 'choco -?


2 Answers

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.

like image 94
ferventcoder Avatar answered Sep 22 '22 07:09

ferventcoder


Run the command as administrator enter image description here

like image 29
AkshayKrison Avatar answered Sep 23 '22 07:09

AkshayKrison