Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows - Can't find file on PATH, '.' not in PATH

Tags:

windows

perl

I installed a package (Strawberry Perl) and added its bin directory (C:\Strawberry\perl\bin) to the environment variables. cpan is a package manager, its in there as cpan.bat.

When I try to run it, heres what happens:

C:\Users\horse> cpan -fi "DBD::mysql"
Can't find C:\Strawberry\perl\bin\cpan.bat on PATH, '.' not in PATH.

Its obviously finding the file because how else would it know its exact location: C:\Strawberry\perl\bin\cpan.bat

If I try running cpan.bat directory like this:

C:\Users\horse> C:\Strawberry\perl\bin\cpan.bat  -fi "DBD::mysql"
Can't find C:\Strawberry\perl\bin\cpan.bat on PATH, '.' not in PATH.

Same issue. I don't understand why it needs a '.' in the PATH, but I added it there to see what would happen, and its no longer saying anything about a '.' but I'm still getting the same issue with it not finding cpan.bat:

C:\Users\horse> cpan
Can't find C:\Strawberry\perl\bin\cpan.bat on PATH.

Does anyone know what the issue is here?

like image 221
Horse O'Houlihan Avatar asked Nov 14 '16 00:11

Horse O'Houlihan


People also ask

What does it mean if a file is not on path?

You do not have permissions to the file or the file location. The file is on a location that is not currently accessible like a network location or an external drive that is not currently connected to the PC. The file has been moved or deleted.

Why is my file not showing in folder?

The most possible reason is your files are hidden. Other factors might be some malware or virus attacking your disk and hiding or even deleting your files so that you won't see them in the folder. Some users also report that problems with compression tools can also cause your files to not be displayed.

How do I fix the system Cannot find the file specified?

Run CHKDSK Command to Fix "System Cannot Find File Specified" Device. Right-click the Start button, type cmd in the Search, and select Command Prompt (Admin). Type chkdsk x: /f /r (x represents your target drive) into the Command Prompt window and press Enter Wait while chkdsk tries to repair the corrupted file systems ...


1 Answers

The problem was I had two perl.exe files installed, when I ran get-command perl, it said its located in C:\Program Files\Git\usr\bin\perl.exe. So its using the version that came with with what looks like a CygWin install (C:\Program Files\Git\usr\bin\ is loaded with unix like commands). So I removed perl.exe from C:\Program Files\Git\usr\bin and it fixed the problem.

like image 162
Horse O'Houlihan Avatar answered Oct 22 '22 18:10

Horse O'Houlihan