Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Import-Module from Gallery #71

Closed
brianbunke opened this issue Nov 14, 2016 · 7 comments
Closed

Import-Module from Gallery #71

brianbunke opened this issue Nov 14, 2016 · 7 comments

Comments

@brianbunke
Copy link
Contributor

PS C:\> Install-Module Vester
PS C:\> Import-Module Vester

Import-Module : The specified module 'Vester' was not loaded because no valid module file was found in any module directory.
At line:1 char:1
+ Import-Module Vester
+ ~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (Vester:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Upon inspecting my default install directory, C:\Program Files\WindowsPowerShell\Modules\, I noticed two things:

  1. The top-level Vester folder was included in the gallery publish, causing the above error to replicate from Module Overhaul #63
    1. Hopefully we can publish one level down? No need for that top level to be included, if possible
  2. There is no version folder. My other modules look like C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.3\{contents}
    1. Maybe this fixes itself once we iterate past 1.0.0?

I have not yet published anything to the gallery, so I'm pretty helpless here.

@chriswahl
Copy link
Member

I'll look into item 1. The version wasn't pushed into the Gallery for use, more so just to hold the name.

I believe item 2 is as expected. I don't have version folders for modules with only one version installed. Once there are multiple versions, there are version folders.

@equelin
Copy link
Contributor

equelin commented Nov 14, 2016

You're right for 1. Only the module has to be published on the gallery.

Oddly I always have a version folder even if I install only one version of a module or the module as only one version available on the gallery...

It make me think that we should think about an automated release pipeline that will not mess things up when releases on the gallery.... I'm currently working on that on another project (https://github.com/equelin/Unity-Powershell). I hope to be able to show something soon !

@chriswahl
Copy link
Member

chriswahl commented Nov 14, 2016

@equelin There's no option to choose which folders to publish into the gallery. My typical process is to import the module and then publish it, and that only brings in the module folder itself ... I dunno why the Publish-Module cmdlet decided to put more in there than required (most likely we need to double check the manifest).

@equelin
Copy link
Contributor

equelin commented Nov 14, 2016

@chriswahl Instead of importing the module then publishing it you need to go to the Vester git repository on your computer and export the module's folder

cd  C:\Code\GitHub\Vester
Publish-Module -Name .\Vester -NuGetApiKey <apiKey>

Let me kwnow if it helps. Sometimes it's hard for me to provide explanations in english...

@brianbunke
Copy link
Contributor Author

While setting up a build release pipeline on a personal repo, I found that you can do

Publish-Module -Path .\Vester -NuGetApiKey <apiKey>

-Name isn't required if you just give the direct path instead, which was a welcome discovery to me (same situation, top-level GitHub crap).

Side note: I got really frustrated with the cmdlet help for the PowerShellGet commands while working on that. Not the easiest area to navigate.

@chriswahl
Copy link
Member

I've published Vester version 1.0.1 to the PowerShell Gallery. It seems to be working on my test workstation. Anyone else confirm so I can close this issue?

@brianbunke
Copy link
Contributor Author

Working here 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants