Published: November 20 2013

Getting Foreman working on Windows 7 after installing the Heroku Toolbelt

Following the Getting Started with Node.js on Heroku tutorial, I ran into a couple of problems with running the "foreman start" command.

Firstly the command wasn't found at all and I got the following error:

'foreman' is not recognized as an internal or external command,
operable program or batch file.

To fix this add the path to the ruby bin folder to the PATH environment variable, in my case it was 'C:\Program Files (x86)\Heroku\ruby-1.9.2\bin'.

Then when I tried to run the command I got a 'Bad file descriptor' error:

C:\Projects\HerokuSample>foreman start
Bad file descriptor
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:372:in `read_nonblock'
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:372:in `block (2 levels) in watch_for_output'
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:368:in `loop'
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:368:in `block in watch_for_output'
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:88:in `rescue in notice_signal': uninitialized constant Errno::EINT (NameError)
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:85:in `notice_signal'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:69:in `block (2 levels) in register_signal_handlers'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:401:in `call'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:401:in `wait2'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:401:in `watch_for_termination'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/engine.rb:60:in `start'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/lib/foreman/cli.rb:41:in `start'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0/bin/foreman:7:in `<top (required)>'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/bin/foreman:23:in `load'
        from C:/Program Files (x86)/Heroku/ruby-1.9.2/bin/foreman:23:in `<main>'

After some digging around I found out this is due to a bug with this version (0.63, and also 0.62) of foreman on windows 7, so to get around it you need to go back to version 0.61 by uninstalling foreman and installing the older version:

gem uninstall foreman
gem install foreman -v 0.61

After that everything was peachy and I was able to get the sample 'hello world' app running on my machine.

C:\Projects\HerokuSample>foreman start
13:13:10 web.1  | started with pid 6512
13:13:10 web.1  | Listening on 5000

 


Need Some NodeJS Help?

Search fiverr for freelance NodeJS developers.


Follow me for updates

On Twitter or RSS.


When I'm not coding...

Me and Tina are on a motorcycle adventure around Australia.
Come along for the ride!


Comments


Supported by