Lymedo
Lymedo

Reputation: 608

Unable to import installed PowerShell module

I've created an Azure Artifacts feed to host my PowerShell modules and I'm able to install them locally to a directory listed in the PSModulePath list.

My issue is that when I come to use the module it is not available in active memory and I get an error when trying to import the module by name:

Import-Module : The specified module 'module-name' was not loaded because no valid module file was found in any module directory.

If I use Get-Module, the module is not listed.

If I use Get-InstalledModule, it appears in the list.

If I import the module using the full path then I am able to use the module, but I don't want to specify the full path as I will eventually be using the module in a DevOps release pipeline.

In this scenario, how can I import the module into my script?

Upvotes: 0

Views: 2054

Answers (1)

Lymedo
Lymedo

Reputation: 608

Using Test-ModuleManifest identified that the ModuleVersion didn't match the version number in the module file path. Updating the ModuleVersion resolved the issue.

Upvotes: 2

Related Questions