Jony
Jony

Reputation: 157

Ruby not working on windows term 'rails' is not recognized

I’m using Windows 10, installed Ruby 2.6.14 and bash 4.3.42(5). And I can’t run ruby, the error follows below:

PS F:\App\App> rails c
rails : The term 'rails' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ rails c
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (rails:String) [], CommandNotFoundEx
   ception
    + FullyQualifiedErrorId : CommandNotFoundException

In edit environment variable, I have : C:\Ruby24-x64\bin\

Thanks in advance for your help

Upvotes: 1

Views: 3938

Answers (3)

Kunj Patel
Kunj Patel

Reputation: 11

Open a command prompt, or power shell, or terminal in runs as administrator mode and then execute the gem install rails in it.

Because package manager program or installer program required permission to create, write and read directory and files.

Upvotes: 0

Barpaio
Barpaio

Reputation: 90

It seems like you need to install rails with

gem install rails

Upvotes: 3

nerding_it
nerding_it

Reputation: 704

I think you have not installed rails, The error is saying the command rails is not found in path. Follow below steps to fix this issue

  1. Install rails using gem (gem install rails), usually it should fix problems
  2. If above steps doesn't work then check your path in environment, If it is not pointing to rails command then updating path should fix this issue

Upvotes: 1

Related Questions