I'm trying to start a new rails app and for some reason my computer is no longer recognising rails....it's been working fine on every other rails app I've been working on until now.
When I typed;
rails new test_app -d postgresql -T
It threw up this error:
/home/camillavk/.rvm/gems/ruby-2.1.5/bin/rails:23:in `load': cannot load such file -- /home/camillavk/.rvm/gems/ruby-2.1.5/gems/rails-4.2.0/bin/rails (LoadError)
from /home/camillavk/.rvm/gems/ruby-2.1.5/bin/rails:23:in `<main>'
from /home/camillavk/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
from /home/camillavk/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
The same error is being thrown when I type rails -v. But when I type which rails I get
/home/camillavk/.rvm/gems/ruby-2.1.5/bin/rails
I then tried to run gem install rails and all it says is 1 gem installed
Any ideas on why rails is doing this on my computer and how to fix it?
*EDIT
gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/camillavk/.rvm/gems/ruby-2.1.5
- RUBY EXECUTABLE: /home/camillavk/.rvm/rubies/ruby-2.1.5/bin/ruby
- EXECUTABLE DIRECTORY: /home/camillavk/.rvm/gems/ruby-2.1.5/bin
- SPEC CACHE DIRECTORY: /home/camillavk/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/camillavk/.rvm/rubies/ruby-2.1.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/camillavk/.rvm/gems/ruby-2.1.5
- /home/camillavk/.rvm/gems/ruby-2.1.5#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/camillavk/.rvm/gems/ruby-2.1.5/bin
- /home/camillavk/.rvm/gems/ruby-2.1.5#global/bin
- /home/camillavk/.rvm/rubies/ruby-2.1.5/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /home/camillavk/bin
- /usr/local/java/jdk1.8.0_25/bin
- /home/camillavk/.rvm/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /home/camillavk/.rvm/bin
In case anyone else runs into this issue, I figured that rvm was just getting confused so I told it to use an older version of ruby
$ rvm use 1.9.3
THEN I ran rails new again. This time it worked so I changed into the new app, opened up the gemfile and in there told it to use the newer version of ruby again.
#camillavk,
Please see if the following rvm website link helps (make sure the info. included in these files mentioned in the article is accurate when you check them).
When I first started to use rvm, I used to have such issues as well so I am very careful to define all the rvm setup files for my rails projects.
RVM Projects
I just figured out a exactly the same problem and just used the following command:
gem uninstall -a
Which deletes all unnecessary gems. After that my environment worked well.
Related
I am hosting a Rails app on AWS EC2 instance and am deploying my application with Capistrano. During deployment I have been able to solve errors by installing missing tools like Monit. However, I'm stumped by this error: puma stderr: bash: bundle: command not found. I see bundler is installed on the server, but when i type bundle the terminal says Could not locate Gemfile. I have even tried reinstalling bundler gem install bundler but bundle command is still not recognized. I have listed details about my deployment target below. I'm not sure what to do and would appreciate any help.
gem environment returns:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /home/ubuntu/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /home/ubuntu/.rbenv/versions/2.6.5/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/bin
- SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
- /home/ubuntu/.gem/ruby/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/ubuntu/.rbenv/versions/2.6.5/bin
- /home/ubuntu/.rbenv/libexec
- /home/ubuntu/.rbenv/plugins/ruby-build/bin
- /home/ubuntu/.rbenv/shims
- /home/ubuntu/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
echo $PATH returns
/home/ubuntu/.rbenv/shims:/home/ubuntu/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
which gem returns
/home/ubuntu/.rbenv/shims/gem
locate bundle returns
/home/ubuntu/.gem/specs/rubygems.org%443/quick/Marshal.4.8/bundler-1.17.1.gemspec
/home/ubuntu/.rbenv/shims/bundle
/home/ubuntu/.rbenv/shims/bundler
/home/ubuntu/.rbenv/versions/2.6.5/bin/bundle
/home/ubuntu/.rbenv/versions/2.6.5/bin/bundler
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/build_metadata.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/capistrano.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/cli
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/cli.rb
...
Seems like some puma setting was overwritten. I added the following line to deploy.rb : set :rbenv_map_bins, %w{rake gem bundle ruby rails puma pumactl} to get past this error.
Link to the solution:
https://github.com/seuros/capistrano-puma/issues/206
If you use bundler, you should add capistrano-bundler. See GitHub issue
This question already has an answer here:
Why is Ruby 1.9.2 on Windows 7 using a 1.9.1 path for gems? it is using c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb
(1 answer)
Closed 4 years ago.
I've been struggling with this for a while now. I want to use ruby-2.4.1 in my application and installed rbenv and also installed 2.4.1 with it.
I can confirm that ruby -v prints out 2.4.1 is being used.
gem env leads to the following:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.11
- RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /Users/thementoria/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: /Users/thementoria/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /Users/thementoria/.rbenv/versions/2.4.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/thementoria/.rbenv/versions/2.4.1/bin
- SPEC CACHE DIRECTORY: /Users/thementoria/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/thementoria/.rbenv/versions/2.4.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /Users/thementoria/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0
- /Users/thementoria/.gem/ruby/2.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/thementoria/.rbenv/versions/2.4.1/bin
- /usr/local/Cellar/rbenv/1.1.1/libexec
- /Users/thementoria/.rbenv/bin
- /Users/thementoria/.rbenv/shims
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/MacGPG2/bin
Note that my USER INSTALLATION DIRECTORY, INSTALLATION DIRECTORY and GEM PATHS have 2.4.0 in it.
What causes this to happen?
In my .bashrc I have:
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
Any help would be appreciated.
All is fine. Ruby assumes that all gems within a minor version are fully compatible.
This is probably based on a 20 year old decision which would allow you to transfer installed gems within patch versions of Rubies, by simply copying or symlinking them, without downloading them again. I doubt that the same decision would be made today.
I'm setting up a new Mac and trying to get dev environemnt set up. Using Homebrew & RVM as package managers. I have bundler installed when i run bundler -v from root it get Bundler version 1.13.6 no problem.
However I've just cloned one of my app projects locally and when in that app's directory bundler returns command not found. Surley I shouldn't need to install Bundler when in each directory?!? Is this some user permisisons issue? Can you help me understand this situation and why bundler doesn't work in the newly pulled app directory? Ultimately I'm just trying to bundle install the gemfile for this newly cloned application.
gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/usr/.rvm/gems/ruby-2.2.2
- RUBY EXECUTABLE: /Users/usr/.rvm/rubies/ruby-2.2.2/bin/ruby
- EXECUTABLE DIRECTORY: /Users/usr/rvm/gems/ruby-2.2.2/bin
- SPEC CACHE DIRECTORY: /Users/usr/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/usr/.rvm/rubies/ruby-2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /Users/usr/.rvm/gems/ruby-2.2.2
- /Users/usr/.rvm/gems/ruby-2.2.2#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/usr/.rvm/gems/ruby-2.2.2/bin
- /Users/usr/.rvm/gems/ruby-2.2.2#global/bin
- /Users/jusr/.rvm/rubies/ruby-2.2.2/bin
- /Users/usr/.rvm/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
echo $PATH
/Users/usr/.rvm/gems/ruby-2.2.2/bin:/Users/usr/.rvm/gems/ruby-2.2.2#global/bin:/Users/usr/.rvm/rubies/ruby-2.2.2/bin:/Users/usr/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
which gem
/Users/usr/.rvm/rubies/ruby-2.2.2/bin/gem
You need to issue the following command:
rmv use 2.2.2
I tried installing Dradis framework on Kali Linux,my testing operating system.I have followed the instructions given hereGit Repo for Dradis and after executing
ruby bin/setup
it created separate folders for each framework and then when executing the next command
`bundle exec rails server`
the installation file broke and gave an error.
bundler: command not found: rails
Install missing gem executables with `bundle install`
Later i checked my rails environment and it gave me this..
> RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /var/lib/gems/2.1.0
- RUBY EXECUTABLE: /usr/bin/ruby2.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/test/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/2.1.0
- /home/test/.gem/ruby/2.1.0
- /usr/share/rubygems-integration/2.1.0
- /usr/share/rubygems-integration/2.1
- /usr/share/rubygems-integration/all
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/local/games
- /usr/games
I even tried this link correspond to same errorError Link in Issues but the result was same.Is there any way i can completely remove rails from my Kali Linux and re install it again and update it.
Dradis committer here, first thing that comes to mind is that you're using the old repo, and not the new one.
Old:
https://github.com/dradis/dradis-legacy
New:
https://github.com/dradis/dradis-ce
Then make sure to run bundle install.
Also, check the official Install from Git guide.
Did you run
bundle install
? This will install all the gems specified in the Gemfile, which includes installing Rails.
bundle exec rails server
should work after that
I had big troubles with fixing RoR that works on my linux mint. Now when all seems to work fine, it doesn't. I'll describe it by c/p my terminal.
matth#MatijaComp /media/Data/My Documents/Sites $ rails -v
Rails 4.2.3
matth#MatijaComp /media/Data/My Documents/Sites $ cd mynewapp/
matth#MatijaComp /media/Data/My Documents/Sites/mynewapp $ rails -v
Warning: You're using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
Rails 4.2.1
Well.. Outside of project folder its 4.2.3 version and inside its 4.2.1 version with warning. I was trying to remove this warning by stopping spring spring stop , but nothing happens..And when I try to update Rubygems it says that I have already the newest version.
Then my question is if someone would like to explain me why those versions aren't synchronized and guide me to fix this problem. Thank you!
Update
I fixed rails version, but problem still appears on this warning. when I type gem env it says:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/matth/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /home/matth/.rbenv/versions/2.2.2/bin/ruby
- EXECUTABLE DIRECTORY: /home/matth/.rbenv/versions/2.2.2/bin
- SPEC CACHE DIRECTORY: /home/matth/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/matth/.rbenv/versions/2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/matth/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- /home/matth/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/matth/.rbenv/versions/2.2.2/bin
- /home/matth/.rbenv/libexec
- /home/matth/.rbenv/plugins/ruby-build/bin
- /home/matth/.rbenv/bin
- /usr/local/bin
- /usr/local/sbin
- /usr/local/mysql/bin
- /home/matth/.rbenv/shims
- /home/matth/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /home/matth/bin
- /usr/local/java/jdk1.8.0_45/bin
- /home/matth/bin
- /usr/local/java/jdk1.8.0_45/bin
Now, which ever action I do with rails command in my project folder it gives me this warning. IN ADDITION, I figured out that commands even don't work. it just appears this:
matth#MatijaComp /media/Data/My Documents/Sites/myfourthapp $ rails generate controller demo index
Warning: You're using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
matth#MatijaComp /media/Data/My Documents/Sites/myfourthapp $
I have "fixed" problem temporary by commenting gem 'spring' in Gemfile. But it is not the way out of this problem.
Rails is just a gem. Among with other gems in the project, it is managed by bundler on a per-project basis.
If you need to change gem version, just specify it in the Gemfile, and run bundle install.