-
Notifications
You must be signed in to change notification settings - Fork 902
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
"C:\Program Files\WindowsPowerShell\Modules" is missing in PSModulePath for cmd.exe #830
Comments
This really is a blocking issue for our adoption of Chocolatey 0.9.10. |
I think this is the same as #818? |
So wait, this works properly from PowerShell, but not from cmd? Also, does it work if you use |
It works from PowerShell, but not from Command Prompt. So the main issue here is that the environment variables used by a powershell script started from a Command Prompt (via choco install) is using the machine environment setting and not the PowerShell process environment settings and therefor is missing the path |
I've seen #295 in action also for 0.9.9.12. We had to work around that for the cases where we installed chocolatey as part of the script. When installing chocolatey PSModulePath is set back to the machine level setting for that process. But, this did not affect the Command Prompt after the initial installation. This PSModulePath issue is new. We don't use Update-SessionEnvironment at all. Look at the repro. Only add one line in you chocolateyinstall.ps1 |
PSModulePath is at least partially generated dynamically by PowerShell. Some standard locations are not present in registry values at HKLM\System\CurrentControlSet\Control\Session Manager\Environment and HKCU\Environment:
|
Any progress on a fix? |
Was working on this last night, so yes. This week or early next week for new version that will hopefully include this fix. |
This should be fixed in 0.10.0. |
When PowerShell starts up, it sets at least Program Files path and sometimes the Documents PSModulePath for PowerShell. Ensure those items are set if they are missing, as they may be missing when running choco from cmd.exe (but available when running choco from powershell.exe).
* stable: (23 commits) (GH-897) Fix DISM /all for newer Windows versions (maint) bring back in nuspec into solution folders (GH-598) Add output directory for choco pack (version) bump to 0.10.0 (doc) update CHANGELOG/nuspec (GH-840) Do not set User Environment for SYSTEM (GH-840) Set TMP to cacheLocation as well (GH-830) Ensure process PSModulePath items (GH-112) Relax HTTPS checksum failure (maint) move noop run (GH-833) Don't set profile under certain conditions (doc) update generated docs (GH-112) update options for new version (GH-112) Checksums / Install Template (GH-112) Update parameter documentation (GH-112) Require checksums (GH-112) Allow Empty Checksums (GH-112) Checksum remote files unless checksum (GH-112) Allow user passed checksums (GH-112) rename checksum files for proper casing ...
What You Are Seeing?
Incorrect PSModulePath in Chocolatey 0.9.10.2 and 0.9.10.3 when you run choco from a normal command prompt(not powershell).
"C:\Program Files\WindowsPowerShell\Modules" is missing in PSModulePath
What is Expected?
In chocolatey 0.9.9.12 it used to get the correct PowerShell process environment variable for PSModulePath. This path contains the "C:\Program Files\WindowsPowerShell\Modules" path. Now it only use the Machine wide PSModulePath where "C:\Program Files\WindowsPowerShell\Modules" is missing
How Did You Get This To Happen? (Steps to Reproduce)
Import-Module MyModule
The specified module 'MyModule' was not loaded because no valid module file was found in any module directory.
Output Log
The chocolatey log does not provide any additional information. I can provide it if you absolutely need it, but the easiest thing is to follow the steps to reproduce this issue.
The text was updated successfully, but these errors were encountered: