I have ruby 2.0.0 and rails 4 , up until today I always was able to do rails new . and get a project running.
But today when I tried to run it I got
/usr/bin/rails:22:in `load': cannot load such file -- /Users/potter/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/bin/rails (LoadError)
from /usr/bin/rails:22:in `<main>'
potters-MacBook-Pro:test potter$ rvm list
rvm rubies
ruby-1.9.3-p448 [ x86_64 ]
=* ruby-2.0.0-p247 [ x86_64 ]
# => - current
# =* - current && default
# * - default
I have no idea what changed , any suggestions ?
The permissions to my /User/<mac username>/.rvm changed for some reason from 755 to 744. I think it might have to do due to an installation of rjb.
fixed with chmod
It seems like you already have ruby and rails installed in your system (/usr/bin/rails). I think you should clean all current rails and reinstall it from scratch
Related
I am trying to use wicked_pdf and wkhtmltopdf, but everytime I run it I get the following error.
RuntimeError: Error: Failed to execute: ["/home/daveomcd/.rvm/gems/ruby-2.3.4/bin/wkhtmltopdf", "-q", "--encoding", "utf-8", "--disable-javascript", "--disable-internal-links", "--disable-external-link...
I think the issue is that it's executing from the /.rvm/gems/ruby-2.3.4/.. directory instead of my /.rvm/gems/ruby-2.5.1/.., but I can't seem to get it to switch tot he 2.5.1 directory. I'm using rvm and it's currently set to 2.5.1 as seen here. Where else would I need to check to change this? I've also uninstalled and install all of my gems and bundler, but no luck.
daveomcd#mcdonald-PC9020:~/rails_projects/bane$ rvm list
rvm rubies
ruby-2.3.4 [ x86_64 ]
=* ruby-2.5.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Oddly, I figured out the issue shortly after posting. My issue was I was using it in conjuction with Sidekiq. I needed to kill my sidekiq process and then restart the process. I guess it had started up when I was on a separate project. Thanks to anyone that took a look at my question.
I recently installed Ruby 2.1.1 with RVM, and I set that to the default. In my root directory it correctly sets current to ruby-2.1.1:
$ rvm list
rvm rubies
ruby-1.9.3-p448 [ x86_64 ]
ruby-1.9.3-p545 [ x86_64 ]
=* ruby-2.1.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ which ruby
$ /Users/mynamehere/.rvm/rubies/ruby-2.1.1/bin/ruby
But when I move into my rails project, current is set back to 1.9.3, even though default is 2.1.1:
$ rvm list
rvm rubies
ruby-1.9.3-p448 [ x86_64 ]
=> ruby-1.9.3-p545 [ x86_64 ]
* ruby-2.1.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ which ruby
$ /Users/mynamehere/.rvm/rubies/ruby-1.9.3-p545/bin/ruby
Can someone tell me why the current ruby version changes depending on my directory, and how I can set 2.1.1 to be the default? I've tried doing "$ rvm --default use 2.1.1" in my project directory, but that doesn't fix the issue.
Thanks!
You probably have a .ruby-version file in your Rails project folder which establishes the default for that project. Check for that and, if you have it, you can remove it or change it's contents to the version you want to use for that particular Rails project.
It's discussed (rather tersely) in the rvm website under Typical RVM Project Workflow.
You can also define your gemset specific to the project as well. It's a cool feature if you have multiple projects that require different versions.
I am trying to fix my RVM. Last week everything was working fine but today for some reason my rails commands are not working. For example, if I try:
rails new blog
I get this error:
.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require': cannot load such file -- rails/version (LoadError)
Is this because my ruby version is outdated? does anyone know how I could fix this? I looked all over and only found the rvm get stable command however that did not fix my issue. Thank you to anyone that knows what is going on here.
Sorry for the bad formatting, here you go.
here is ruby -v:
`
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
here is the error I get with rails -v:
/home/tyrel/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require': cannot load such file -- rails/version (LoadError)
here is rvm list:
rvm rubies ruby-1.9.3-p448 [ x86_64 ] ruby-1.9.3-p484 [ x86_64 ] =* ruby-2.0.0-p247 [ x86_64 ] ruby-2.0.0-p353 [ x86_64 ] # => - current # =* - current && default # * - default
thanks for the help but upon further research I found what I needed to do.
First I ran:
gem pristine --all
Then I found another post on here that recommended trying this:
You need to run the follow
user$ source ~/.rvm/scripts/rvm
then run this
user$ type rvm | head -n 1
and if you get
rvm is a function
the problem is solved.
You also need to run user$ rvm requirements to see dependency requirements for your operating system
Source: https://rvm.io/rvm/install/
I forget mention that you need to put this code into you ~/.bashrc or ~/.zshrc file and you will not need to write this code again. Cheers! -Jorge Garcia
After all that my RVM was fixed, and I can use my rails new projectname command.
Thanks for all the help community!!!<3
I have been using RVM for almost a year now without a problem, but suddenly it started to behave odd a day ago. First of all I wasn't able to enter the Rails console or server - it just told me that it couldn't be found anywhere. After running bundle install it fetched all Gems again as if none of them had been installed previously. This worked until I restarted my machine - after that I had to bundle again.
I am not aware of changing anything in the system that could trigger this kind of behaviour. Did anybody experience something like it before?
I am running the latest stable RVM release on Ubuntu 13.10
Try the following:
rvm list
You should see something like this:
ruby-2.0.0-p0 [ x86_64 ]
=* ruby-2.1.0-preview1 [ x86_64 ]
The =* indicates ruby-2.1.0-preview1 is my current and default ruby version.
Try switching to another ruby version, in my case:
rvm use ruby-2.0.0-p0
the rvm list command should now yield ( => means current, * default):
=> ruby-2.0.0-p0 [ x86_64 ]
* ruby-2.1.0-preview1 [ x86_64 ]
What's happening with you is probably that rvm is switching versions when you reboot. You might want to set the version you want to use as default, in my case:
rvm use ruby-2.0.0-p0 --default
rvm list
=* ruby-2.0.0-p0 [ x86_64 ]
ruby-2.1.0-preview1 [ x86_64 ]
Every time I open a new terminal in Mac OSX Lion, rails isn't loaded. This is after I upgraded to ruby 1.9.3 and rails 3.2 - so I was doing a lot of configuring but not sure what I've screwed up. It used to work fine.
If I load a new terminal on startup, and type:
rvm
that works.
If I type
ruby -v
I get the correct (1.9.3)
but if I type rails -v, I get an error saying:
/Users/userishere/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [rake-0.9.2.2, rake-0.9.2] (Gem::LoadError)
from /Users/userishere/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/userishere/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
from /usr/bin/rails:18:in `<main>'
If I type:
rvm use 1.9.3p0#rails32 --default
That makes rails work as normal, but only in that terminal window -even a new tab in terminal, rails gives errors - how do I get it to accept that gemset/config as the global default whenever I start up? I have:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
in my .bash_profile.
What have I done to my config / missed in my upgrade? It seems like something simple, but I'm not spotting it.
I just switched my own default rvm by using the command rvm 1.9.2-p290#mybranch --default (not that I didn't have 'use' in the command)
Then, if you open a new terminal window or tab and type rvm list you should see a => next to the ruby version it's using. I see this:
ree-1.8.7-2010.02 [ x86_64 ]
ruby-1.8.7-p302 [ x86_64 ]
ruby-1.9.1-p378 [ x86_64 ]
ruby-1.9.2-p0 [ x86_64 ]
ruby-1.9.2-p136 [ x86_64 ]
ruby-1.9.2-p180 [ x86_64 ]
=> ruby-1.9.2-p290 [ x86_64 ]
I like to see which rvm version and gemset I'm using next to my command prompt. In your .bash_profile right before the line you listed that loads the RVM function, add this:
PS1="\$(~/.rvm/bin/rvm-prompt i v g s) $PS1"
Which prepends this to my prompt: ruby-1.9.2#myapp
rvm 1.9.3-p0#rails32 --default only set it working for the current terminal window, once I added another or exited and came back it was back to not working.
I fixed this by adding a .rvmrc file to my app directory. It now loads the gemset & ruby version correctly.
As per:
http://seanbehan.com/mac-os-x/installing-and-using-rvm-on-mac-os-x-creating-gemsets-and-reverting-to-original-environment/