chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.21k stars 896 forks source link

Cannot find file at '../choco.exe' (C:\Windows\choco.exe). This usually indicates a missing or moved file. #930

Closed philippe2070 closed 8 years ago

philippe2070 commented 8 years ago

I install chocolatey on a fresh windows 10 Anniversary update. Installing is built in a script when installing windows. Some pc's work fine, some do not. Are all the same pc's. The pc where it is not working I tried installing windows 10 manually, but it keeps refusing to install chocolatey for one reason. I deleted all files in C:\ProgramData\chocolatey (yes also the hidden folders) and copied all files from a working pc onto the faulty one. Issue is still the same.

One thing is remarkable when typing in a command which is unknown then the expected error appears

when typing in choco then error like in the title appears when typing in psexec then next error appears: Cannot find file at '..\lib\pstools\tools\PsExec.exe' (C:\Windows\lib\pstools\tools\PsExec.exe). This usually indicates a missing or moved file.

Even I have not installed pstools, same is with some commands from sysinternals.

Only think installed by scripting is: windows 10 (32bit) version 1607 + office 2016 + choco on different pc's (alle same model) and some do work and some do not.

please help

What You Are Seeing?

Error Cannot find file at '../choco.exe' (C:\Windows\choco.exe). This usually indicates a missing or moved file.

What is Expected?

Chocolatey v0.9.10.3 (version info)

How Did You Get This To Happen? (Steps to Reproduce)

step one: elevated powershell I install chocolatey (also with different approaches will give same result) iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex step two: close prompt step three: open prompt choco Error Cannot find file at '../choco.exe' (C:\Windows\choco.exe). This usually indicates a missing or moved file.

Output Log

PS C:\Users\marvin> iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex

Mode LastWriteTime Length Name


d----- 24/08/2016 14:56 chocInstall Getting latest version of the Chocolatey package for download. Downloading https://chocolatey.org/api/v2/package/chocolatey/0.10.0 to C:\Users\marvin\AppData\Local\Temp\chocolatey\ch cInstall\chocolatey.zip Download 7Zip commandline tool Downloading https://chocolatey.org/7za.exe to C:\Users\marvin\AppData\Local\Temp\chocolatey\chocInstall\7za.exe Extracting C:\Users\marvin\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\marvin\AppData\Local\Te p\chocolatey\chocInstall...

7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Processing archive: C:\Users\marvin\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip

Extracting _rels.rels Extracting chocolatey.nuspec Extracting tools\chocolateyInstall.ps1 Extracting tools\chocolateysetup.psm1 Extracting tools\init.ps1 Extracting tools\chocolateyInstall\choco.exe Extracting tools\chocolateyInstall\choco.exe.ignore Extracting tools\chocolateyInstall\LICENSE.txt Extracting tools\chocolateyInstall\helpers\chocolateyInstaller.psm1 Extracting tools\chocolateyInstall\helpers\chocolateyProfile.psm1 Extracting tools\chocolateyInstall\helpers\chocolateyScriptRunner.ps1 Extracting tools\chocolateyInstall\helpers\ChocolateyTabExpansion.ps1 Extracting tools\chocolateyInstall\helpers\functions\Format-FileSize.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-CheckSumValid.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-ChocolateyUnzip.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-ChocolateyWebFile.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-EnvironmentVariable.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-EnvironmentVariableNames.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-FtpFile.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-OSArchitectureWidth.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-ToolsLocation.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-UACEnabled.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-UninstallRegistryKey.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-VirusCheckValid.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-WebFile.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-WebFileName.ps1 Extracting tools\chocolateyInstall\helpers\functions\Get-WebHeaders.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-BinFile.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyDesktopLink.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyEnvironmentVariable.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyExplorerMenuItem.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyFileAssociation.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyInstallPackage.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyPackage.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyPath.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyPinnedTaskBarItem.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyPowershellCommand.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyShortcut.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyVsixPackage.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-ChocolateyZipPackage.ps1 Extracting tools\chocolateyInstall\helpers\functions\Install-Vsix.ps1 Extracting tools\chocolateyInstall\helpers\functions\Set-EnvironmentVariable.ps1 Extracting tools\chocolateyInstall\helpers\functions\Set-PowerShellExitCode.ps1 Extracting tools\chocolateyInstall\helpers\functions\Start-ChocolateyProcessAsAdmin.ps1 Extracting tools\chocolateyInstall\helpers\functions\Test-ProcessAdminRights.ps1 Extracting tools\chocolateyInstall\helpers\functions\Uninstall-BinFile.ps1 Extracting tools\chocolateyInstall\helpers\functions\Uninstall-ChocolateyEnvironmentVariable.ps1 Extracting tools\chocolateyInstall\helpers\functions\Uninstall-ChocolateyPackage.ps1 Extracting tools\chocolateyInstall\helpers\functions\UnInstall-ChocolateyZipPackage.ps1 Extracting tools\chocolateyInstall\helpers\functions\Update-SessionEnvironment.ps1 Extracting tools\chocolateyInstall\helpers\functions\Write-ChocolateyFailure.ps1 Extracting tools\chocolateyInstall\helpers\functions\Write-ChocolateySuccess.ps1 Extracting tools\chocolateyInstall\helpers\functions\Write-FileUpdateLog.ps1 Extracting tools\chocolateyInstall\redirects\choco.exe Extracting tools\chocolateyInstall\redirects\choco.exe.ignore Extracting tools\chocolateyInstall\redirects\chocolatey.exe Extracting tools\chocolateyInstall\redirects\chocolatey.exe.ignore Extracting tools\chocolateyInstall\redirects\cinst.exe Extracting tools\chocolateyInstall\redirects\cinst.exe.ignore Extracting tools\chocolateyInstall\redirects\clist.exe Extracting tools\chocolateyInstall\redirects\clist.exe.ignore Extracting tools\chocolateyInstall\redirects\cpack.exe Extracting tools\chocolateyInstall\redirects\cpack.exe.ignore Extracting tools\chocolateyInstall\redirects\cpush.exe Extracting tools\chocolateyInstall\redirects\cpush.exe.ignore Extracting tools\chocolateyInstall\redirects\cuninst.exe Extracting tools\chocolateyInstall\redirects\cuninst.exe.ignore Extracting tools\chocolateyInstall\redirects\cup.exe Extracting tools\chocolateyInstall\redirects\cup.exe.ignore Extracting tools\chocolateyInstall\redirects\cver.exe Extracting tools\chocolateyInstall\redirects\cver.exe.ignore Extracting tools\chocolateyInstall\redirects\RefreshEnv.cmd Extracting tools\chocolateyInstall\tools\7z.dll Extracting tools\chocolateyInstall\tools\7z.exe Extracting tools\chocolateyInstall\tools\7z.exe.ignore Extracting tools\chocolateyInstall\tools\7z.exe.manifest Extracting tools\chocolateyInstall\tools\7zip.license.txt Extracting tools\chocolateyInstall\tools\checksum.exe Extracting tools\chocolateyInstall\tools\checksum.exe.config Extracting tools\chocolateyInstall\tools\checksum.exe.ignore Extracting tools\chocolateyInstall\tools\checksum.license.txt Extracting tools\chocolateyInstall\tools\detector.zip Extracting tools\chocolateyInstall\tools\shimgen.exe Extracting tools\chocolateyInstall\tools\shimgen.exe.ignore Extracting tools\chocolateyInstall\tools\shimgen.license.txt Extracting package\services\metadata\core-properties\b71b0b2f574b4729aa2134477128b378.psmdcp Extracting [Content_Types].xml

Everything is Ok

Files: 87 Size: 11599385 Compressed: 6894450 Installing chocolatey on this machine Creating ChocolateyInstall as an environment variable (targeting 'Machine') Setting ChocolateyInstall to 'C:\ProgramData\chocolatey' WARNING: It's very likely you will need to close and reopen your shell before you can use choco. Restricting write permissions to Administrators We are setting up the Chocolatey package repository. The packages themselves go to 'C:\ProgramData\chocolatey\lib' (i.e. C:\ProgramData\chocolatey\lib\yourPackageName). A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin' and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when upgrading from a version of Chocolatey less than 0.9.9. 'Batch file could not be found' is also safe to ignore. 'The system cannot find the file specified' - also safe. chocolatey.nupkg file not installed in lib. Attempting to locate it from bootstrapper. PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding... WARNING: Not setting tab completion: Profile file does not exist at 'C:\Users\marvin\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'. Chocolatey (choco.exe) is now ready. You can call choco from anywhere, command line or powershell by typing choco. Run choco /? for a list of functions. You may need to shut down and restart powershell and/or consoles first prior to using choco. Ensuring chocolatey commands are on the path Ensuring chocolatey.nupkg is in the lib folder

philippe2070 commented 8 years ago

found problem myselves, seemed an issue with duplicate names in system32 folder...

timmywil commented 8 years ago

@philippe1970 Could you provide more detail on how you fixed it? I think I'm having the same issue. As soon as I close and reopen the command prompt, choco is unrecognized.

philippe2070 commented 8 years ago

Hello timmywil

I was creating an image for windows 10, with a script to automate the setup of choco.

I had some issues with creating the script and while debugging I thought to be smart. I copied all files from C:\ProgramData\chocolatey\bin to c:\windows\system32 in the windows setup cd. This was just to test.

But what I did not knew was that these files are a kind of link to the actual files, installed elsewhere.

When creating new image, I forgot to remove these from the C:\Windows\System32 and the files are linking relative and not to an absolute path. In the path searchorder C:\ProgramData\chocolatey\bin is after C:\Windows\System32 and so the files in C:\ProgramData\chocolatey\bin are never found.

Result is the commands are executed from C:\Windows\System32 and pointing to the wrong relative path.

This was in my case my own fault.

timmywil commented 8 years ago

I see. I think my problem stems from my use of git-bash (choco doesn't get into my path).