Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module version not playing nicely with #Requires statement #3

Closed
DanGough opened this issue May 13, 2021 · 2 comments
Closed

Module version not playing nicely with #Requires statement #3

DanGough opened this issue May 13, 2021 · 2 comments
Labels

Comments

@DanGough
Copy link
Owner

For some reason, most likely a bug in Powershell, if you add this Requires statement to your code:

#Requires -Modules @{ ModuleName='Nevergreen'; ModuleVersion='2105.2' }

It fails with:

ResourceUnavailable: The script 'AutoPackager.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are missing: Nevergreen.

Yet it works if you retry!

I suspect this might be down to the version format used. I have copied the version format used by Evergreen, i.e. YYMM.Build, except my first release was 2105.001. However when I published the module it was coming up as 2105.1. Seeing that it stripped the preceeding zeroes, I just called the next release 2105.2 in the module manifest.

Visiting the Powershell Gallery at https://www.powershellgallery.com/packages/Nevergreen though redirects to 2105.1 instead of the latest version, which is odd, and the reason why I suspect the version being a cause.

@DanGough DanGough added the WTF label May 13, 2021
@DanGough
Copy link
Owner Author

Next release will be 2105.100 to see if it alleviates this.

@DanGough
Copy link
Owner Author

I think this is resolved now.

When publishing the module, empty folders are removed. The Private folder was empty, and a non-existent Private folder was throwing an error during the init of import-module. Adding -ErrorAction Ignore to the line that scans for functions there seems to have sorted it!

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

No branches or pull requests

1 participant