Pode.Web
Pode.Web copied to clipboard
InvalidOperation: /usr/local/share/powershell/Modules/Pode/Private/Helpers.ps1:933
I've created a docker image:
FROM badgerati/pode.web:latest
COPY . /usr/src/app/
EXPOSE 9999
CMD [ "pwsh", "-c", "cd /usr/src/app; ./blahblahs.ps1" ]
When the docker image starts, the script crashes a few times before loading the webserver.
InvalidOperation: /usr/local/share/powershell/Modules/Pode/Private/Helpers.ps1:933
Line |
933 | $null = Import-Module $path -DisableNameChecking -Scope Globa …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The running command stopped because the preference variable
| "ErrorActionPreference" or common parameter is set to Stop: An item with
| the same key has already been added. Key: 595860939
at Import-PodeModules, /usr/local/share/powershell/Modules/Pode/Private/Helpers.ps1: line 933
at Open-PodeRunspace, /usr/local/share/powershell/Modules/Pode/Private/Helpers.ps1: line 603
at <ScriptBlock>, <No file>: line 1
After a few restarts, it works fine.
I tried combatting this by putthing this in the top of blahblah.ps1 (before importing pode.web) with:
$global:ProgressPreference = 'SilentlyContinue'
$global:ErrorActionPreference = 'SilentlyContinue'
Is there something obvious i'm doing wrong ? :)
Interesting 🤔
I've seen this error over in Pode, and it was fixed in the latest version - just need to update Pode.Web accordingly.
The error was thrown when other modules were available for being automatically imported. Is there any other modules you're using? Are you using a server.psd1 file at all?
i'm not using a server.psd1 file :) i just import with Import-Module Pode.Web
i'll wait until a new build. No rush. it's just a minor inconvenience ;)