简体   繁体   中英

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:

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. Why is Rails not installed? What else should I do? Thanks

Looks like this is rdoc related. Short version, try :

gem install rdoc

And then launch the install of rails again.

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. 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

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.

I would recommend you using RVM which is a ruby version manager. 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.

I highly recommend you searching and reading about these concepts:

  • RVM
  • Gemsets
  • .rvmrc
  • .bashrc and .bash_profile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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