Error while installing kubectl in Windows 10 - windows

Installing the kubectl on windows 10 not working. I follow this URL.
I tried different install options, in the powershell and using chocolote. None of them worked for me. The error is clear that this execuable is not supported for windows os. I did checked the SHA but it is different.
PS D:\chocoloate_tmpdir> curl -o kubectl.exe.sha256 https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/windows/amd64/kubectl.exe.sha256
PS D:\chocoloate_tmpdir> Get-FileHash kubectl.exe
Algorithm Hash Path
--------- ---- ----
SHA256 02F984988E490046CBC831A582D34505C28C7DD9AB61C357E264C7178596B701 D:\chocoloate_tmpdir\kubectl.exe
PS D:\chocoloate_tmpdir> Get-FileHash .\kubectl.exe.sha256
Algorithm Hash Path
--------- ---- ----
SHA256 98BCEB6AF839704828C28709B60628E25CF5F624A6D6E7D06F1FC255AA4254CB D:\chocoloate_tmpdir\kubectl.exe.sha256
question is, what could be the issue and what other methods are available for installing kubectl in windows.
Here are the commands tried and error output:
one:
PS D:\chocoloate_tmpdir> choco install kubernetes-cli Chocolatey v0.10.15
Installing the following packages:
kubernetes-cli
By installing you accept licenses for the packages.
Progress: Downloading kubernetes-cli 1.17.1... 100%
kubernetes-cli v1.17.1 [Approved]
kubernetes-cli package files install completed. Performing other installation steps.
The package kubernetes-cli wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y
Extracting 64-bit C:\ProgramData\chocolatey\lib\kubernetes-cli\tools\kubernetes-client-windows-amd64.tar.gz to C:\ProgramData\chocolatey\lib\kubernetes-cli\tools...
C:\ProgramData\chocolatey\lib\kubernetes-cli\tools
Extracting 64-bit C:\ProgramData\chocolatey\lib\kubernetes-cli\tools\kubernetes-client-windows-amd64.tar to C:\ProgramData\chocolatey\lib\kubernetes-cli\tools...
C:\ProgramData\chocolatey\lib\kubernetes-cli\tools
ShimGen has successfully created a shim for kubectl.exe
The install of kubernetes-cli was successful.
Software installed to 'C:\ProgramData\chocolatey\lib\kubernetes-cli\tools'
Chocolatey installed 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS D:\chocoloate_tmpdir> kubectl version --client Program 'kubectl.exe' failed to run: The specified executable is not a valid application for this OS platform.At line:1 char:1
+ kubectl version --client
+ ~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ kubectl version --client
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
two:
PS D:\chocoloate_tmpdir> curl -o kubectl.exe https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/windows/amd64/kubectl.exe
PS D:\chocoloate_tmpdir> cp .\kubectl.exe C:\bin\
PS D:\chocoloate_tmpdir> kubectl version Program 'kubectl.exe' failed to run: The specified executable is not a valid application for this OS platform.At line:1 char:1
+ kubectl version
+ ~~~~~~~~~~~~~~~.
At line:1 char:1
+ kubectl version
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed

You've probably missed some of these steps:
Copy the binary to a folder in your PATH. If you have an existing
directory in your PATH that you use for command line utilities, copy
the binary to that directory. Otherwise, complete the following steps.
Create a new directory for your command line binaries, such as C:\bin.
Copy the kubectl.exe binary to your new directory.
Edit your user or system PATH environment variable to add the new directory to your PATH.
Close your PowerShell terminal and open a new one to pick up the new PATH variable.
Please verify what is the current content of your PATH. You can move your kubectl binary directly to one of those folders which are already added to your PATH. Alternatively you may edit it and add your desired directory containing kubectl. Have you relaunched your PowerShell terminal after saving the changes ? It's quite straightforward to configure and there is no need to use full paths to the executable.
Take a look at this article in the official kubernetes docs.
Please let me know if it helps.

Calling the command from the current path does the trick. I have added the executable to c:\bin path and added the path to system environment variable, somehow it was not set, not sure why. Its an issue with the execuable being not found in the path.
PS D:\chocoloate_tmpdir> kubectl version Program 'kubectl.exe' failed to run: The specified executable is not a valid application for this OS platform.At line:1 char:1
+ kubectl version
+ ~~~~~~~~~~~~~~~.
At line:1 char:1
+ kubectl version
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
PS D:\chocoloate_tmpdir> .\kubectl.exe version Client Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.7-eks-1861c5", GitCommit:"1861c597586f84f1498a9f2151c78d8a6bf47814", GitTreeState:"clean", BuildDate:"2019-09-24T22:12:08Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"windows/amd64"}
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

Related

Failure: plugin grpc-gateway: could not find protoc plugin for name grpc-gateway -

while genrating Prot buff using "buf generate"
i am getting below error :
Failure: plugin grpc-gateway: could not find protoc plugin for name grpc-gateway - please make sure protoc-gen-grpc-gateway is installed and present on your $PATH
i have tried installtion of
"go install google.golang.org/grpc/cmd/protoc-gen-go-grpc#latest; "
$ go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway#latest
$ go install google.golang.org/protobuf/cmd/protoc-gen-go#latest
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc#latest
then check for your path , if its not set then use below command :
PATH="${PATH}:${HOME}/go/bin"
The error is specifically for protoc-genc-grpc-gateway which is distinct from proto-gen-go-grpc.
See the Installation instructions that include protoc-gen-grpc-gateway.
You will also need that the plugin is in your host's PATH. On Linux you can which protoc-gen-grpc-gateway to confirm this after installation.

VCPKG package installation fails on wrong path with semicolon

I'm new to MSYS2, VCPKG and CMAKE. I want to build package MSDFGEN via MSYS2/UCRT64 and VCPKG on Windows. What I did so far:
Installed Visual Studio Community Edition + Installed MSYS2 + started UCRT64 console
Added paths C:\msys64\ucrt64\bin;C:\msys64\usr\bin;
Then in UCRT64 console:
pacman -Syu
pacman -Su
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain git cmake
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat -disableMetrics
./vcpkg.exe integrate install
./vcpkg.exe install msdfgen
Result:
Computing installation plan...
The following packages will be built and installed:
* brotli[core]:x86-windows -> 1.0.9#4
* bzip2[core,tool]:x86-windows -> 1.0.8#3
* freetype[brotli,bzip2,core,png,zlib]:x86-windows -> 2.12.1#3
* libpng[core]:x86-windows -> 1.6.39
msdfgen[core]:x86-windows -> 1.9.2
* vcpkg-cmake[core]:x64-windows -> 2022-10-30
* vcpkg-cmake-config[core]:x64-windows -> 2022-02-06#1
* zlib[core]:x86-windows -> 1.2.13
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
error: while detecting compiler information:
The log file content at "C:\msys64\home\myname\vcpkg\buildtrees\detect_compiler\stdout-x64-windows.log" is:
CMake Error at C:/msys64/home/myname/vcpkg/scripts/ports.cmake:110 (message):
Cannot find port:
Directory does not exist: C;/msys64/home/myname/vcpkg/scripts/detect_compiler
error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.
Directory detect_compiler exists, but notice that path includes semicolon. How do I fix this?
Most likely the issue is with some incorrectly set environment variable in your system (or any other CMake variable) to debug this issue I would start by figuring out if you can find the variable responsible (maybe it's the PATH) variable. To debug this, try running this command in powershell:
dir env: | out-string -stream | Select-String -Pattern "C;/msys64"
Or just:
dir env: | out-string -stream | Select-String -Pattern "C;"
After you figure out which variable it is, then you can set it properly.
EDIT: I've noticed that you aren't using the correct triplets (I've mentioned it in the comments, but here it may have better formatting):
Try exporting these variables, so that you download the correct triplets when using mingw64:
export VCPKG_DEFAULT_TRIPLET=x64-mingw-dynamic
export VCPKG_DEFAULT_HOST_TRIPLET=x64-mingw-dynamic
As is mentioned here in this link
EDIT2: It may seem that the UCRT64 environment is not supported by VCPKG, hence I am not sure if the MinGW triplets will solve the issue (but you may try).

How to install Cypress from local zip file using npm

I wanted to install Cypress using npm - but my corporate firewall is blocking.
So I tried the below method in my Terminal in Visual Studio Code - But getting an error (pasted below)
Any idea on why this script does not work? and solution to it?
PS C:\Users\c64881a\Desktop\NPM_Cypress> CYPRESS_INSTALL_BINARY=C:/Users/c64881a/Downloads/cypress.zip npm install cypress
CYPRESS_INSTALL_BINARY=C:/Users/c64881a/Downloads/cypress.zip : The term 'CYPRESS_INSTALL_BINARY=C:/Users/c64881a/Downloads/cypress.zip' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1
CYPRESS_INSTALL_BINARY=C:/Users/c64881a/Downloads/cypress.zip npm ins ...
+ CategoryInfo : ObjectNotFound: (CYPRESS_INSTALL...ads/cypress.zip:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Please, try this in PowerShell:
setx CYPRESS_INSTALL_BINARY C:/Users/c64881a/Downloads/cypress.zip

Why is 7-Zip failing during this Chocolatey installation on Windows 10?

I am trying to install Chocolatey
https://chocolatey.org/install
and using the command:
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
It is showing error:
Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install
again. Error: 7-Zip encountered a fatal error while extracting the files
At line:221 char:9
+ 2 { throw "$errorMessage 7-Zip encountered a fatal error while ex ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to unzip...cting the files:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompres
sion = 'true' and call install again. Error: 7-Zip encountered a fatal error while extracting the files
I have 7zip installed.
I encounter the same issue.
Running window cmd as administrator may be a solution for some but in my case i had to update my window system environment variable,
I just added this to exiting value on
path: $env:chocolateyUseWindowsCompression = 'true'
and all works just fine.
I had the same error when I was trying to install chocolatey on multiple servers which was finally getting blocked at chocolatey server, which is a chocolatey feature.
https://chocolatey.org/docs/community-packages-disclaimer#rate-limiting
Hence the downloaded file is null and cannot be unzipped. The block is lifted an hour later. After rate limit is lifted, the errors disappears until you trigger it again.
Rate limiting also applies to other packages. When limit is hit while downloading a package other than chocolatey itself, you will get an error code 429.
https://chocolatey.org/docs/troubleshooting#im-getting-a-429-too-many-requests-issue-when-attempting-to-use-the-community-package-repository
First answer: Running window cmd as administrator may be a solution for some but in my case i had to update my window system environment variable, I just added this to exiting value on path: $env:chocolateyUseWindowsCompression = 'true' and all works just fine.
may not work immediately and you still receive "Unable to unzip package using 7zip." error.
Try again after restarting your machine. In my case command works after restarting.
Thx
karam
After a few months, i ran the same command from cmd with Administrative Privilege and it worked. The main point was running
cmd.exe As an Administrator.

Unable to find module providers

I'm having an issue with PowerShell. It's almost like it's not installed all the way; which is weird since it's Windows 10 and it ships with it.
With no lock, I've tried replacing the following directories with a fresh copy from another Windows 10 machine that is working:
C:\Users\UserName\AppData\Local\PackageManagement
C:\Program Files\WindowsPowerShell
C:\Program Files (x86)\WindowsPowerShell
C:\Windows\System32\WindowsPowerShell
I also tried SFC /scannow, but it found no issues. I've searched for hours and haven't been able to find anyone with the exact same issue. Does anyone have any ideas?
System Information:
PS C:\WINDOWS\system32> [environment]::OSVersion.Version
Major Minor Build Revision
----- ----- ----- --------
10 0 10586 0
PS C:\WINDOWS\system32> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 0 10586 122
Errors:
PS C:\WINDOWS\system32> Get-PSRepository
PackageManagement\Get-PackageSource : Unable to find module providers (PowerShellGet).
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:3544 char:31
+ ... ckageSources = PackageManagement\Get-PackageSource #PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument:(Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource
], Exception
+ FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource
PS C:\WINDOWS\system32> Get-PackageProvider -Name PSModule -ForceBootstrap
Get-PackageProvider : Unable to find package provider 'PSModule'. It may not be imported yet. Try 'Get-PackageProvider
-ListAvailable'.
At line:1 char:1
+ Get-PackageProvider -Name PSModule -ForceBootstrap
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvi
der], Exception
+ FullyQualifiedErrorId : UnknownProviderFromActivatedList,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPacka
geProvider
The below returns nothing:
PS C:\WINDOWS\system32> Get-PackageProvider -ListAvailable
PS C:\WINDOWS\system32>
If your end goal is to install packages from Chocolatey or something similar with PowerShell you would want to perform the following.
To import the Module you would execute the following:
Import-Module PackageManagement
To install the package providers you would execute the following:
Install-PackageProvider -Name Chocolatey -Force
To find a package within the package provider Chocolatey you would execute the following (you could use wildcard for name to get all packages available):
Find-Package -Name SomePackageNameHere -ProviderName Chocolatey
Lastly, to install a package from Chocolatey you would execute the following:
Install-Package -Name SomePackageNameHere -ProviderName Chocolatey -Force
I hope this helps!
Looks like I solved the issue. I installed Chocolatey by using the CMD.exe method.
I ran CMD.exe as an administrator and ran the following command:
#powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
Now I have a PS Repository:
PS C:\WINDOWS\system32> Get-PSRepository
Name PackageManagementProvider InstallationPolicy SourceLocation
---- ------------------------- ------------------ --------------
PSGallery NuGet Untrusted https://www.powershellgallery.com/api/v2/
I'm guessing something during the install of Chocolatey, repaired whatever was broken.

Resources