我遇到了一个非常奇怪的问题,试图让rails在我的系统上工作。每次我安装后尝试运行rails都说我需要安装。如果有人能指出我正确的道路或给我一些如何进一步排除故障的提示,将不胜感激。
非常感谢
$ rails 当前未在此系统上安装Rails。要获取最新版本,只需输入:
$ sudo gem install rails
然后您可以重新运行“rails”命令。
$ sudo gem install rails
Fetching: rails-4.0.2.gem (100%)
Successfully installed rails-4.0.2
Parsing documentation for rails-4.0.2
Installing ri documentation for rails-4.0.2
Done installing documentation for rails after 436 seconds
1 gem installed
$ which rails
/usr/local/bin/rails
$ gem list
*** LOCAL GEMS ***
actionmailer (4.0.2)
actionpack (4.0.2)
activemodel (4.0.2)
activerecord (4.0.2)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
arel (4.0.1)
atomic (1.1.14)
bigdecimal (1.2.3)
builder (3.1.4)
bundler (1.5.2)
erubis (2.7.0)
hike (1.2.3)
i18n (0.6.9)
io-console (0.4.2)
json (1.8.1)
mail (2.5.4)
mime-types (1.25.1)
minitest (4.7.5)
multi_json (1.8.4)
polyglot (0.3.3)
psych (2.0.2)
rack (1.5.2)
rack-test (0.6.2)
**rails (4.0.2)**
railties (4.0.2)
rake (10.1.0)
rdoc (4.1.0)
sprockets (2.10.1)
sprockets-rails (2.0.1)
test-unit (2.1.0.0)
thor (0.18.1)
thread_safe (0.1.3)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (0.3.38)
$ rails -v
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
答案 0 :(得分:1)
Rails在这里:
$ which rails
/usr/local/bin/rails
但是调用rails不起作用:
$ rails -v
Rails is not currently installed on this system.
这意味着bash在PATH
变量中没有路径。
要添加它(假设你在Mac上),请发出
$ echo 'export PATH='/usr/local/bin:$PATH'" >> ~/.bash_profile
然后用
重新加载$ source ~/.bash_profile
然后看它是否识别rails
命令。