Heroku.bat giving ‘The system cannot find the path specified’ on Windows Vista 64-bit

UPDATE: This issue has been fixed now!

So today I created an account on Heroku and downloaded the Heroku Toolbelt for Windows. The installer seemed to work very well but on attempting to run the heroku command I got an error message:

The system cannot find the path specified.

After some digging around I found out that this is a problem in the batch file Heroku uses to start Ruby, heroku.bat. This batch file is trying to determine the path to Ruby but for some reason is failing on Windows Vista. I managed to get it to work by adding two lines that solve the issue on Vista and (I think) won’t break other systems (Windows 7). Here is the fragment that I changed, with the lines I added marked:

:: determine if this is x86 or x64
if "%processor_architecture%" == "IA64" goto x64
if "%processor_architecture%" == "AMD64" goto x64

if "%ProgramFiles%" == "%ProgramW6432%" goto x64
goto x86

This fix works because currently there are two 64-bit architectures, IA64 (Intel) and AMD64 (AMD) and the two lines I added directly detect those architectures and swith to the correct code branch if found. So if you have this same issue, just open heroku.bat (in C:\Program Files (x86)\heroku\bin usually) and add the highlighted lines in the correct position. I’ll see if I can submit this solution to the Heroku team.

The cause of the issue seems to be that the ProgramW6432 environment variable is apparently not always set (at least it’s not set on my system) so alternatively, you can set that environment variable yourself. Make it point to %ProgramFiles% by setting it in the User environment variables through Start -> Control Panel -> System -> Advanced system settings -> Tab 'Advanced' -> Button 'Environment Variables'.

I mentioned this issue on the Heroku Google group and David Dollar picked it up and incorporated it into the Heroku Toolbelt source code. It is probably available in the latest release by now. Thanks David!

4 responses to “Heroku.bat giving ‘The system cannot find the path specified’ on Windows Vista 64-bit

  1. Hi,

    I still have this issue, even with this fixed in the Heroku.bat file and with path’s set. Do you have any suggestions?

  2. The error message is pretty generic so first thing to do would be to make sure it is the same path that cannot be found. Sprinkle some ‘echo’ statements throughout the batch file to check where it is giving this message…

  3. Hi,

    I have Windows 8 x64 and just installed Heroku client for Windows.
    But when I try to run heroku.bat he told me this:
    C:/Program Files (x86)/Heroku/lib/heroku/updater.rb:154:in `spawn’: No such file
    or directory – open (Errno::ENOENT)
    from C:/Program Files (x86)/Heroku/lib/heroku/updater.rb:154:in `backgro
    from C:/Program Files (x86)/Heroku/lib/heroku/updater.rb:135:in `inject_
    from C:/Program Files (x86)/Heroku/bin/heroku:19:in `’

    Could you have any idea what is wrong?


  4. Well, from the extension .rb I would conclude that these are Ruby files. I am not skilled in Ruby, but from what I know this is a scripting language and the .rb source files will be in plain text on your disk. So find the files listed in the error message, open them with a text editor, skip to the mentioned lines and see what’s in there. If you see a path to a file there, see if you can locate that file on disk and change the path to match the ones on your computer.

    If you can get it to work that would be great, but even then I think you should report it as a bug with the Heroku team and maybe they can get it fixed. They were really quick to respond to my bug report so hopefully they will be able to help you as well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s