-
Notifications
You must be signed in to change notification settings - Fork 61
Windows installer breaks PSModulePath #524
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
Comments
@justinian, thanks for reporting the bug. Do you mean that the installer remove ~/Documents/WindowsPowerShell/Modules from the path too? |
I'm actually not sure of the original value, it might have been empty, or it may have contained the default value. According to this MSDN article:
I'm not sure if that means the permanent settings are updated the first time PowerShell runs, or if this is the default if PowerShell is started without a PSModulePath set. I have not explicitly set the variable myself. However, I do see that the system-wide setting is correct, and had the SDK path properly appended:
|
@justinian, that's interesting. I wasn't able to repro this on my machine by installing the SDK for a specific user. Can I ask do you have this problem when you install it system-wide? |
(Sorry for the late reply!) I believe I installed it system-wide previously since both the user and system paths were modified. Testing on another machine system-wide, I see that it only touched my system-wide PSModulePath and it looks correct, so |
I have also experienced that it overwrites the PSModulePath environment variable. This is highly annoying. |
Same thing happened to me today. |
It seems like the issue happens if the PSModulePath for User is empty initially. We are fixing this in the next cloud SDK release. |
@quoctruong I'm glad this will be fixed -- this caused a problem for me with the latest PowerShell 7 preview (and probably in the final release): PowerShell/PowerShell#11172 |
@deisner This should already be fixed with the latest version of the Google Cloud SDK. |
@quoctruong I start out with a
I then run the latest GoogleCloudSDKInstaller.exe, checking the options to install Cloud Tools for PowerShell, and to run gcloud init. After installation, PSModulePath is set in the user scope, to this:
Is this the intended behavior? This is on Windows 10 Enterprise 1909, by the way. |
What is the version of your Google Cloud SDK? |
I should add that the new behavior of PowerShell 7 preview.6 might be under review -- arguably the user and machine PSModulePath environment variables should be concatenated (or kept concatenated) by PowerShell, which was the previous behavior. See PowerShell/PowerShell#11172 (comment). |
I see. So you are using PowerShell 7 in this case? Is it possible to test it under PowerShell 6? |
I am using PowerShell 7-preview.6. There was no problem with PowerShell 7-preview.5 or earlier. I just installed PowerShell 6.22, and my PSModulePath looks like this:
... while in PowerShell 7.0.0-preview.6 it looks like this:
... and (after uninstalling PS7-preview.6 and re-installing PS7-preview.5), in Powershell 7.0.0-preview.5 it looks like this:
And, for completeness, here's PowerShell 5.1:
My User PSModulePath environment variable:
and finally, my System PSModulePath is
|
@deisner So what did the Cloud SDK installation do to your PSModulePath? |
Just to save time: regarding my previous comment
It looks like this is indeed a problem with PS7-preview.6, and that the behavior will be fixed: PowerShell/PowerShell#11172 (comment) In short, I don't think it's not a Cloud SDK issue. |
I got this problem (my PSModulePath is broken) and actually, I need to use SDK and some modules that are getting fail to import. |
I have a number of user-scope modules installed in
~/Documents/WindowsPowerShell/Modules
, which is in the PSModulePath by default. After installing via the windows installer, under user variables, my PSModulePath was set to;C:\Users\justin\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell
(note the leading;
, which looks like a failed attempt to append to the existing path), which caused the default path to not be searched, and my modules to all fail to import. This was a simple fix once I had figured out what was going on, but it took some time to discover.The text was updated successfully, but these errors were encountered: