13

I'm finding Windows 10 package management not very intuitive. Below are my adventures in trying to install VLC, which sounds like a very common test case for a package manager.

Find-Package vlc

Nope

Find-Package -Update

Nope

Install-Package --help

Nope

Install-Package /?

Nope

Install-Package vlc

The provider 'nuget v2.8.5.127' is not installed.
nuget may be manually downloaded from https://oneget.org/nuget-anycpu-2.8.5.127.exe and installed.
Would you like PackageManagement to automatically download and install 'nuget' now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):
Install-Package : No match was found for the specified search criteria and package name 'vlc'.
At line:1 char:1
+ Install-Package vlc
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Nope

Register-PackageSource -Name chocolatey -Location http://chocolatey.org/api/v2 -Provider PSModule -Trusted -Verbose

Maybe?

Install-Package vlc
WARNING: The module 'vlc' cannot be installed or updated because it is not a properly-formed module.

Nope

MC10
  • 9,564
  • 4
  • 37
  • 52
Jonathan
  • 1,678
  • 10
  • 28
  • 47
  • Try [`Install-Package -Name VLC`](http://www.howtogeek.com/200334/windows-10-includes-a-linux-style-package-manager-named-oneget/). – MC10 Aug 15 '15 at 16:31
  • `Install-Package -Name VLC` `Install-Package : No match was found for the specified search criteria and package name 'VLC'.` – Jonathan Aug 15 '15 at 16:35
  • Does `Find-Package -Name VLC` find anything for you? Also, check if it's case sensitive. – MC10 Aug 15 '15 at 16:36
  • `Find-Package -Name VLC` Find-Package : No match was found for the specified search criteria and package name 'VLC'. At line:1 char:1 + Find-Package -Name VLC + ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exceptio n + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage – Jonathan Aug 15 '15 at 16:37
  • So I played around with it some more. I got the same error you did for VLC but installing `putty` worked. Not sure who's side the problem is on now. – MC10 Aug 18 '15 at 14:02
  • I'm having similar problems with `iojs`. It *finds* the package just fine, but when I try to install it, it says its not found. – mpen Aug 23 '15 at 01:00
  • `help Install-Package` works. – BrunoLM Oct 31 '15 at 21:40
  • 1
    You might wanna do a `update-help` first. – BrunoLM Oct 31 '15 at 21:47
  • Is there any advantage to using Windows' commands rather than chocolatey directly for package that come from the chocolatey repo? – kuzzooroo Dec 02 '17 at 23:52

1 Answers1

10

You were close. First, you have to set the execution policy to allow scripts, otherwise it'll silently fail while reporting success (bug):

Set-ExecutionPolicy RemoteSigned

Both the package provider (Chocolatey plugin) and package source (URL to specific Chocolatey repo) need to be installed/registered with PackageManagement. Get-PackageProvider with the -Force flag causes it to bootstrap, which apparently takes care of both (more in the help about -Force):

Get-PackageProvider Chocolatey -Force | Out-Null

Then I can search for the package:

Find-Package vlc -Force

Name       Version          Source           Summary
----       -------          ------           -------
vlc        2.2.1.20150630   chocolatey       VLC Media Player

And install it (-Force so it doesn't prompt for confirmation):

Install-Package vlc -Force | Out-Null

enter image description here

Vimes
  • 470
  • 1
  • 5
  • 14
  • This doesn't work for me on a clean Windows 10 RTM, it just puts everything in C:\Chocolatey\lib but doesn't actually install the programs or run the scripts required to do so. – RedShift Sep 19 '15 at 14:01
  • 3
    Oh, there's a [terribly confusing bug](https://github.com/OneGet/oneget/issues/97#issuecomment-139331418) in PackageManagement where that exact behavior happens unless, before installing packages, you set the execution policy to allow scripts (I use RemoteSigned). I'll update my answer. – Vimes Sep 19 '15 at 19:12
  • 1
    Great to hear. Hopefully they'll get these wrinkles ironed out. Don't forget to mark the answer if you like :-) – Vimes Sep 20 '15 at 16:10
  • How would I install multiple packages in one line? That's the industry standard for all package managers. It appears I get an error if I run `Install-Package vlc firefox -Force` – Jonathan Jan 19 '16 at 23:34
  • 1
    @JonathanLeaders, just put commas between the package names. – Vimes Jan 20 '16 at 20:16
  • @JVimes This doesn't seem to work anymore. The error is similar to RedShift. If execution policy is set to `RemoteSigned` the script errors out with `The system cannot find...` ; if you reset the execution policty with `Set-ExecutionPolicy Default` it doesn't error out but nothing is installed into Program files. The installers are correctly deposited in `C:\Chocolatey\lib` – xenithorb Jan 06 '17 at 18:58
  • @xenithorb, I confirm what you're seeing. I had so many problems with the Chocolatey provider I gave up on it long ago. Looks its GitHub page is [here](https://github.com/chocolatey/chocolatey-oneget). – Vimes Jan 06 '17 at 19:22