rails command not recognized

1,621 views
Skip to first unread message

Jared Brown

unread,
Jan 30, 2012, 10:15:08 AM1/30/12
to RubyInstaller
I successfully installed Ruby 1.8.7 on a Windows 2003 server using the
one click installer. I have RubyGems 1.8.15 and Bundlr installed. I
then installed the DevKit (downloaded from the GitHub page, probably
did not match the exact one click installer version) but I was able to
install all the gems including native extension ones.

The issue is that "rails" is not a recognized command. How are the
gems added to the path? Maybe if I know that I can figure out what is
failing.

Thank you

Luis Lavena

unread,
Feb 6, 2012, 5:47:47 PM2/6/12
to rubyin...@googlegroups.com

Does "gem" and "ruby" work from a normal command prompt?

Did you install rails through bundler? (doing bundle install in your
application?)

If that is the case, then the problem is bundler and where it places
"bin" scripts.

Please do:

gem list rails -d

And note the path where it was installed (under "Installed at")

Most likely there will be a "bin" directory at the same level which
have both "rails" and "rails.bat"

There are three solutions from my point of view:

1) Install rails from outside the bundler, which will place "rails"
script inside Ruby\bin directory and make it available always

2) Add the path indicated in "Installed at" + "bin" to the PATH variable:

SET PATH=<installed_at>\bin;%PATH%

You can set that in your system variables to avoid manually doing
every single time

3) Use "bundle exec" all the time when executing "rails" command.

I vote for first option.

PS: Sorry took so long to notice your message, Google Groups didn't
email us (admins) about it.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Jared Brown

unread,
Jan 26, 2012, 3:01:08 PM1/26/12
to RubyInstaller
OS: Windows 2003 Server
System path has "C:\ruby187\bin" in it

Steps to recreate:

1. Install ruby 1.8.7 via one click installer
2. Install DevKit-tdm-32-4.5.1-20101214-1400-sfx.exe
3. Install rubygems via gem command
4. Install bundler via gem command
5. Install vendor'ed gems via bundle install --local command
6. Run "gem list", see gems
7. cd to working directory
8. Run "rails server", receive rails command not recognized

What am I missing?

Thank you

Luis Lavena

unread,
Feb 6, 2012, 5:57:30 PM2/6/12
to rubyin...@googlegroups.com
On Thu, Jan 26, 2012 at 5:01 PM, Jared Brown <jared...@gmail.com> wrote:
> OS: Windows 2003 Server
> System path has "C:\ruby187\bin" in it
>

Hello,

> Steps to recreate:
>
> 1. Install ruby 1.8.7 via one click installer
> 2. Install DevKit-tdm-32-4.5.1-20101214-1400-sfx.exe
> 3. Install rubygems via gem command
> 4. Install bundler via gem command
> 5. Install vendor'ed gems via bundle install --local command
> 6. Run "gem list", see gems
> 7. cd to working directory
> 8. Run "rails server", receive rails command not recognized
>
> What am I missing?
>

Sorry, I just answered your other post about this issue:

http://groups.google.com/group/rubyinstaller/msg/34dc8eba03fcaafb

This post confirms what I understood, you used --local option which
will install the gems relative to your application/bundle.

Either you use --binstubs option:

http://gembundler.com/man/bundle-install.1.html

and place the scripts in "bin" (relative to your application)

Which will require you always do "bin\rails" instead of "rails" and
will only work relative to that application.

or install the gem normally with "gem install" and will be installed
at Ruby level.

Reply all
Reply to author
Forward
0 new messages