Reputation: 1
Noob here.
I recently installed rails following the instructions laid out here >> http://installrails.com/steps/install_rails
When I input rails -v in my root directory I get the rails version as expected:
I am typing...rails -v Rails 5.0.1
However, when I cd into my documents folder I am getting 'Gemfile not found' :
I am typing...cd documents
I am typing...rails -v
/Users/Matt/Documents/Gemfile not found
I tried to install rails inside the documents directory, but still received the same output:
I am typing...gem install rails
Successfully installed rails-5.0.1
Parsing documentation for rails-5.0.1
Done installing documentation for rails after 0 seconds
1 gem installed
I am typing...rails -v
/Users/Matt/Documents/Gemfile not found
I can't create any rails applications with rails new while inside my documents folder either. Here is my ruby load_path:
I am typing...irb
2.4.0 :001 > $LOAD_PATH
=> ["/Users/Matt/.rvm/gems/ruby-2.4.0@global/gems/did_you_mean-1.1.0/lib", "/Users/Matt/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0", "/Users/Matt/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/x86_64-darwin15", "/Users/Matt/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby", "/Users/Matt/.rvm/rubies/ruby-2.4.0/lib/ruby/vendor_ruby/2.4.0", "/Users/Matt/.rvm/rubies/ruby-2.4.0/lib/ruby/vendor_ruby/2.4.0/x86_64- darwin15", "/Users/Matt/.rvm/rubies/ruby-2.4.0/lib/ruby/vendor_ruby", "/Users/Matt/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0", "/Users/Matt/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin15"]
Thank you for the help!
Upvotes: 0
Views: 377
Reputation: 7505
It seems like you have a broken installation of ruby/rails.
Use RVM(Ruby Version Manager) to manage your ruby versions/installations. It is still good to use even if you are only using one version. Once RVM is installed, you can the install rails gem. It keeps everything clean so that you don't have to deal with paths etc.
Try the following to get your environment in 'rails' shape:
curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm install 2.3.1
rvm default use 2.3.1
cd /path/to/my/projects
gem install rails
rails -v
rails new test-project
Hopefully this works for you!
Upvotes: 1
Reputation: 66
RVM can solve your problem, you can have several versions of ruby installed, what you should do is create a gemset per project.
To install it go to: https://rvm.io/rvm/install, use Install RVM stable with ruby.
After installing it, go to the directory where you want to create the new rails project and make the following commands:
rvm gemset create yourApp rvm gemset use yourAppName gem install rails rails new yourAppName
And you must do that for every project you want to create, this will help you to keep the appropriate version of ruby, rails, etc. For each project.
Upvotes: 1