简体   繁体   English

安装Rails-即使我没有,我也没有

[英]Installing Rails - It says I didn't even though I did

I am trying to run a 我正在尝试运行

rails new demo

But am told: 但被告知:

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.

I run that command, and many 'fetching' lines followed by many 'Installing RDoc documentation for...' are run, but then the last lines say: 我运行该命令,然后运行许多“获取”行,然后运行许多“为...安装RDoc文档”,但是最后几行说:

Installing RDoc documentation for rails-3.2.13...
file 'lib' not found

and then it stops running, and the 'rails' command (see above) doesn't work still. 然后它停止运行,并且“ rails”命令(参见上文)仍然无法正常工作。 Why is Rails not installed? 为什么未安装Rails? What else should I do? 我该怎么办? Thanks 谢谢

Looks like this is rdoc related. 看起来这与rdoc有关。 Short version, try : 短版,请尝试:

gem install rdoc

And then launch the install of rails again. 然后再次启动rails的安装。

Look at this answer that seems to have helper a lot of people with this exact problem. 看一下这个答案 ,似乎可以帮助很多人解决这个确切的问题。

I solved it: apparently I was trying to install rails in the directory. 我解决了它:显然我正在尝试在目录中安装rails。 I did the following and it worked well: 我做了以下工作,并且效果很好:

cd /

Then I ran 然后我跑了

sudo gem install rails

Then I cd into the relevant directory again and now 然后,我cd到相关目录再次,现在

rails new demo

worked! 工作了!

It's not a good idea to do a 'sudo gem install rails' since you may experience permission problems with your applications in the future. 进行“ sudo gem install rails”不是一个好主意,因为将来您的应用程序可能会遇到权限问题。

I would recommend you using RVM which is a ruby version manager. 我建议您使用RVM ,它是一个Ruby版本管理器。 You can easily install different versions of Rubies, you can create application specific gemset's and minimize possible futuristic 'rails is not currently installed' errors. 您可以轻松地安装不同版本的Ruby,可以创建特定于应用程序的宝石集,并最大程度地减少可能的未来派“当前未安装轨道”错误。

I highly recommend you searching and reading about these concepts: 我强烈建议您搜索和阅读以下概念:

  • RVM RVM
  • Gemsets 宝石集
  • .rvmrc .rvmrc
  • .bashrc and .bash_profile .bashrc和.bash_profile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM