I am trying to create a new rails project but get the error below and my new project directory is empty! I found an issue on the rails github repo but the solution they suggest is to remove spaces in the project directory. I don't have spaces in my project directory, so this solution doesn't apply. If I missed something and can provide anymore information please let me know. Any help is very much appreciated!
$ rails new bookmarks_app
create
Could not find "README" in any of your source paths. Your current source paths are:
/Users/Jared/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/generators/rails/app/templates
$ ls
bookmarks_app
$ ls bookmarks_app/
$ pwd
/Users/Jared/Desktop/Sandbox/website
$ rails --version
Rails 3.2.8
$ ruby --version
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin12.2.0]
Operating System: OSX
I mixed something up during my install because I was trying to use macports and rvm without quite understanding how they work. I was able to reinstall ruby and rails, and it is now working.
Remove old Ruby files/install:
sudo rm -rf ~/.rvm
brew uninstall ruby
sudo rm /usr/local/bin/ruby
Install Ruby and Rails:
brew install ruby
gem install bundler
gem install rails
Related
I'm trying to install Ruby on Rails on MacOS Mojave. Here's what I have so far:
ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
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.
which rails
usr/bin/rails
I've done some research on the issue and it looks like because I used sudo when I originally ran gem install rails, the rails executable got put in a location where it doesn't have access to the right libraries.
How do I fix this or remove the rails executable to start a fresh install from scratch?
Ignore the existing Rails installation in your system Ruby. Don't bother mucking about with any changes you've made to system Ruby and its gems. Just put it in the past and move on:
Install RVM with:
\curl -sSL https://get.rvm.io | bash -s stable
Restart your shell, then install Ruby with:
rvm install 2.6.5
Don't use system Ruby.
Then install Rails (without sudo, never use sudo with Ruby installed by RVM):
gem install rails
I installed ruby and rails and other gems in ubuntu via terminal using rvm
After installation i checked the version of ruby and rails.
Later i closed the terminal. now I am not able to find ruby in it.
I am new to ruby and ubuntu as well. I am sure its installed . But after closing the terminal when I open it again and type "ruby -v"
I get this :
ubuntu#ubuntu:~$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8 (You will have to enable component called 'universe')
Try: sudo apt-get install <selected package>
ubuntu#ubuntu:~$
I would highly suggest using rbenv instead of rvm for Ruby these days.
A guide on how to install it is located here: https://gorails.com/setup/ubuntu/14.10
The Ruby will then be installed in the .rbenv directory that is located in your $HOME folder.
To answer your question on where rvm installs it, it is installed into .rvm folder in your $HOME
I have had rails installed and almost working. Was working on a solution to another problem with I accidentally closed the bash window. So I reopened it, and now I am unable to use rails at all and it's telling me that rails isn't installed. So I ran gem install rails --no-ri --no-rdocand now I get the following:
ERROR: While executing gem ... (Errno::EEXIST)
File exists # dir_s_mkdir - /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems`
How do I correct this error?
I just removed the broken gems, site_ruby and vendor_ruby symlinks from the /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/ folder and now everything seems to work fine.
I just added a gems/ directory here /usr/local/lib/ruby/ and that solved the issue.
for a temporary solution, you can mkdir -p /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems/2.1.0 to solve.
When you open your bash window (called the "terminal window" or "console"), what folder ("directory") are you in? Find out with:
$ pwd
Navigate to the folder where you created your Rails project using the Unix cd command, for example:
$ cd workspace/learn-rails
If you are using RVM, make sure you have selected the correct gemset:
$ rvm gemset list
gemsets for ruby-2.1.1 (found in ...)
(default)
global
=> learn-rails
Then see if Ruby and Rails are installed:
$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
$ rails -v
Rails 4.1.0
Refer to the article Install Ruby on Rails for help. If you haven't followed all the steps in the article, you may have problems, especially if you followed some of the inaccurate instructions found elsewhere on the web.
I was recently in this wormhole. It seems like Homebrew's ruby installation has an issue with soft links and uses version 2.1.1. I couldn't "gem install" anything without getting the annoying "File exists # dir_s_mkdir" error. Even tried MacPort and that was a nightmare.
First uninstall ruby via
brew uninstall ruby
or
port uninstall ruby
And follow the instruction on https://rvm.io/rvm/install to install ruby
\curl -sSL https://get.rvm.io | bash -s stable --ruby
It might then complain about ruby-2.0.0-p353 not installed
To install do:
rvm install ruby-2.0.0-p353
Then run the rvm install script. Your "gem install << whatever >>" should now work
This fixed the issue for me (Homebrew on a Mac, Ruby 2.1.3):
$ brew reinstall ruby
$ brew unlink ruby && brew link ruby
the same issue. I just remove dir_s_mkdir, then pod install. it works for me!
I'm trying to install Rails with the package available at installrails.com. When I type "rails --version" into the terminal, I get this:
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 type in sudo gem install rails, and the terminal says:
Successfully installed rails-4.0.2
But then shows several lines that look like this:
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/belongs_to.png, skipping
When the command prompt reappears, I re-try "rails --version" and get the same "Rails is not currently installed..." error message.
I've tried several times, restarted by system, etc., and nothing works. I'm on Mac OSX 10.8 (Mountain Lion).
Any ideas? Thanks in advance.
Don't use sudo with gem install rails (you bypass RVM that way). Railsinstaller should install RVM with Ruby. Both Rails and Ruby should be in subfolders of /usr/local/rvm/. Cleanest option would be to uninstall Rails, local Ruby and RVM and then run the Railsinstaller again. If you installed Ruby via a package manager, uninstall it with that. In any case run:
sudo gem uninstall -a rails
sudo gem cleanup
rm -rf /usr/local/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/local/bin/testrb
rm -f /usr/local/bin/ri
rm -f /usr/local/bin/rake
rm -f /usr/local/bin/rdoc
rm -f /usr/local/bin/erb
rvm implode
rm -rf ~/.rvm
Now relogin or reboot and run the Railsinstaller.
Answered your question on Reddit, but heres a more specific answer for this issue.
Your Rails is most likely installed either in the system gems, or inside one of the gemsets for whichever version of Ruby you are running inside the RVM or .rbenv gems. Your GEM_PATH is set incorrectly and looking for gems in the wrong location.
Another issue is that you running Rails from the system. Try bundle exec rails and see what is says.
Similar question here: Gem Path Issue: RubyGems looking in the wrong place
I'm using Ubuntu 8.10 and I installed Ruby and Ruby on Rails following the directions on this site. The exact directions I followed are no longer there as it appears the rubyonrails.org wiki has changed recently. But I installed it the long way. Installed Ruby, then Gems, then installed Rails using "gem install rails".
I haven't really messed with Rails for a while, and I tried to use the Gem command today and...
The program 'gem' can be found in the following packages:
* rubygems1.8
* rubygems1.9
Try: sudo apt-get install <selected package>
bash: gem: command not found
That's just weird to me because I installed rails using the gem command. I have been seaching my computer for the gems binary so I could create a link to it in the bin directory but I can't find it. I know it's installed becaues when I run 'script/server' and go to localhost:3000 in a browser I get the following version information:
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.1
Rails version 2.2.2
Active Record version 2.2.2
Action Pack version 2.2.2
Active Resource version 2.2.2
Action Mailer version 2.2.2
Active Support version 2.2.2
Anyone know how I can get my gem command working again? Thanks for any help.
Note: I am new to Rails and fairly new to Ubuntu and Linux in general.
Did you install rubygems from apt-get? If yes, maybe you should try to remove it and install it from source.
Here is another article on installing Rails on Ubuntu:
http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html
Essentially, you can install Ruby from apt-get or source, but it's recommended to install rubygems from source.
You could look to see if it's in:
/usr/bin/gem1.8
if it is, then symlink /usr/bin/gem to it:
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
BTW, here's another tutorial on how to install rails on Ubuntu 8.10:
http://articles.slicehost.com/2009/1/6/ubuntu-intrepid-ruby-on-rails