-
Notifications
You must be signed in to change notification settings - Fork 904
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
Chocolateys PowerShell Installer Module uses non PowerShell 2 compatible syntax #2398
Comments
Could you provide the chocolatey log to assist with troubleshooting? |
Here you go: choco upgrade gimp Log Output
Full Log Output
|
It appears this log is from multiple runs (which is fine, it's just a bunch more to parse through). In looking through it, a few things stand out to me. First this is often there (the term changes based on the package trying to install/upgrade, but the rest is the same). Would it be possible for you to copy the contents of your
In another spot I encountered this:
So just to be clear, you're running Windows 7 Ultimate? I'm sure you're aware that it is out of support from Microsoft for coming up on 2 years: https://www.microsoft.com/en-US/windows/windows-7-end-of-life-support-information. That being said, I'm not aware of anything that we do that would prevent Windows 7 to work, especially given you've got Chocolatey 0.11.1 and there's only one newer that it appears to try to upgrade but is also failing. Although I haven't been able to get a Windows 7 VM setup as I've run into issues with accessing anything on the internet with a fresh Windows 7 VM 😬 |
Could you go back and edit that comment to remove what is not needed. It is HUGE so would help! |
Yes, I am still using windows 7. There are still monthly security updates available until January 2023. |
Here's the content of my C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1:
|
I've edited the comment to capture what appears to be a call to With regards to the contents of the Edit to add: Please put the contents of the log file in a codeblock:
|
|
Thank you for providing that @beatstick I've been able to get a VM updated and verified that this issue is present on PowerShell 2 in Windows 7. I can also say it doesn't exist on PowerShell 4 on Windows 7 (these are the two VMs I have). If you do Alternatively you could upgrade Windows PowerShell on the machine and it should also resolve the issue. For reference, I have verified that this is not an issue in the |
Well firstly, thanks for doing all this work for the one user still running windows 7. No worries. for now. |
If it would not be an issue for some other reason, I would suggest upgrading all the way to PowerShell 5.1.
Another option would be to pin chocolatey, like |
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
Found the bug (thanks git bisect). Have a branch with a fix, will get a PR up tomorrow once I have a chance to properly sign the commit and fix the commit message. With regards to how I got PowerShell 4 on a VM: it was part of the Vagrant box that I found with Windows 7 on it. |
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
PowerShell v2 doesn't recognize `-notin` as it was introduced in v3. This changes to use `-notcontains` which was introduced in v2 and works similar to `-notin`.
* hotfix/0.11.3: (version) 0.11.3-beta (maint) Prevent inclusion of snk file (#2336) Remove quotes from InstallLocation (#877) Set SourceType for packages parsed from config (#2289) Add acknowledgements and license files (#2289) Update Rhino.Licensing dependency (maint) Replace unversioned Rhino.Licensing dll (#2398) Restore PowerShell v2 support (#2412) Switch to output warning on failure
* master: (version) 0.11.3 (version) 0.11.3-beta (maint) Prevent inclusion of snk file (#2336) Remove quotes from InstallLocation (#877) Set SourceType for packages parsed from config (#2289) Add acknowledgements and license files (#2289) Update Rhino.Licensing dependency (maint) Replace unversioned Rhino.Licensing dll (#2398) Restore PowerShell v2 support (#2412) Switch to output warning on failure # Conflicts: # .uppercut
Hi there, we have started getting this issue on our VMs running Windows Server 2016. In our case, the error is happening when trying to install AWSPowershellTools using the following command: Install-Module -Name AWSPowerShell -Force This is the error we are getting:
This is the content of C:\ProgramData\chocolatey\lib\AWSTools.Powershell\tools\chocolateyInstall.ps1:
Here is the log (C:\ProgramData\chocolatey\logs\chocolatey.log): chocolatey.log |
@campanellaf it appears that module installs a Chocolatey package that is using deprecated and removed commands. Per #2469, which is linked in the v1.0 release notes, the Write-ChocolateySuccess and Write-ChocolateyFailure commands have been deprecated for many years and were removed in 1.0. The AWS folks will need to update their Chocolatey package accordingly, those deprecations were put in place quite a while ago. |
@vexx32 Thanks a lot for the reply. |
The commands were deprecated for a number of years, so a warning was shown when they were used. But they still were available until Chocolatey version 1.0.0, where they were removed completely. So the AWS package would not have broken for you until you upgraded to Chocolatey v1.0.0 or newer. |
The chocolatey-compatibility.extension module was created to fix this. If you install that first then the package will not error when using those functions. |
@pauby sounds great, I'm going to give this a try and report back. Thanks a lot for the tip! |
@pauby that did the trick! Thanks a lot, we can now resume our patching process! :)
any idea what's going on there? |
Mistery solved - the script we are using to instal the tool is actually not the one I reported above. The script we are using is explicitly using Thank you very much for the help! :) |
Expected behaviour:
I expect a package being updated
How Did You Get This To Happen? (Steps to Reproduce):
I issuecd the command: choco upgrade all -y
What are you seeing:
You must provide a value expression on the right-hand side of the '-' operator.
The specified module 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1
' was not loaded because no valid module file was found in any module directory.
ERROR: The term 'Install-ChocolateyPackage' is not recognized as the name of a c
mdlet, function, script file, or operable program. Check the spelling of the nam
e, or if a path was included, verify that the path is correct and try again.
The upgrade of gimp was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\gimp\tools\chocolateyInstall.
ps1'.
See log for details.
Chocolatey upgraded 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
ols\chocolateyInstall.ps1'.
See log for details.
The text was updated successfully, but these errors were encountered: