开发者

Starting script/console for Ruby on Rails with Windows

开发者 https://www.devze.com 2023-02-19 22:06 出处:网络
I\'m having trouble starting script/console. I\'ve tried cd\'ing into the project root (\"C:\\MyProject\") then typing \"script/console\" and I get this:

I'm having trouble starting script/console.

I've tried cd'ing into the project root ("C:\MyProject") then typing "script/console" and I get this:

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

And 开发者_运维百科when I type "ruby script/console" I get this:

Ruby: No such file or directory -- script/console (LoadError)

Any ideas? Should I be running these commands from the root? Thanks.


The usage ruby script/console is present in Rails 2.3.x versions and older. I believe you installed Rails 3.x which deprecated that command.

You need to use now rails console or rails c (short version) from the application directory.

Better pay a visit to the Rails guides for all the other changes.


In Windows you need to use backslash (\) instead of the regular slash (/).

script\console should work for you, provided you use Rails 2.x. On Rails 3 use rails console as mentioned by other coleagues.


Is ruby installed? Is it in your PATH?

http://www.ruby-lang.org/en/downloads/

When it installs, look for the checkbox to add ruby to your path.

If it's already installed, then (on Windows 7), go to the Start Orb, type "path" and click on "Edit the system environment variables". Click on "Environment Variables". In the bottom list scroll down to "Path". Select "Path" and click "Edit". At the end of the "variable value" list put another semi-colon and the path to your ruby.exe.

EG: ";C:\Ruby\bin"

DO NOT delete anything else from that field.

0

精彩评论

暂无评论...
验证码 换一张
取 消