this is the error im getting when i "script/server":
can't activate activesupport (= 3.0.0, runtime) for [], already activated activesupport-2.3.8 for ["rails-2.3.8"]
i THINK whats happening here is that something is trying to call in / active "activesupport" for 3.0.0 ... when the "activesupport" for 2.3.8 is already working?
helps?
thanks!
You need uninstall rails 3.0.0 and activesupport 3.0.0.
You can use some different gemset with rvm by example.
Another solution is using bundler with a specific rails version define inside.
If you use bundler you need launch your server with bundler
bundle exec script/server
Related
I am newbie with Rails and here is my problem.
I created a new Rails's folder by this command
rails new freelancer --database=postgresql --javascript=webpack
And it gave me this error :
can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException) from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in activate_bin_path'
from /Users/xxx/.gem/ruby/3.1.2/bin/rails:25:in <main>' from /Users/xxx/.gem/ruby/3.1.2/bin/ruby_executable_hooks:22:in eval'
from /Users/xxx/.gem/ruby/3.1.2/bin/ruby_executable_hooks:22:in <main>'
When I checked my ruby version, it gave me this :
ruby 2.6.10p210 (2022-04-12 revision 67958)
When I checked my rails version by the command rails -v, it still show me this error :
can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)
So I thought that maybe my problem is because of my rails's version it up to date, maybe I must reinstall rails ?
What should I do ? Could you please give me some advices ? Thank you in advance.
This error is railties not installed in your pc. Or your Rube setup is not properly.
Now Try it: install railties gem gem install railties
Than you can crate your new rails application again.
From this line of the error message
/System/Library/Frameworks/Ruby.framework/Versions/2.6
it's saying the ruby version being used is the system installation (that is, the installation that comes with macOS). You almost certainly don't want that.
Try installing ruby using one of the recommended ways.
In my case I'd already installed ruby via the package manager, rbenv.
But ruby -v still referred to the system library (it gave ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin22], which isn't one I installed myself), so I changed it with rbenv versions (to see which versions were installed; you can install a new version with rbenv install x.x.x) and then rbenv global x.x.x to set the ruby version. But the method to use will differ depending on how you install ruby. I wrote a longer answer here. Hope it helps.
I try to create a new Rails application with Rails 4.2:
$ rails _4.2_ new my_app
I get the following error:
/Users/myuser/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/dependency.rb:298:in
`to_specs': Could not find 'railties' (= 4.2) - did find:
[railties-4.2.7.1,railties-4.1.10,railties-4.1.5,railties-4.1.0.beta2]
(Gem::LoadError)
These are the railties I have:
$ gem list | grep railties
railties (4.2.7.1, 4.1.10, 4.1.5, 4.1.0.beta2)
Why is it demanding that I use railties 4.2 and not one of the others I have, such as 4.2.7.1?
gem install railties - it should fix your problem. At least it helped me
You get the error because you have explicitly specified that you want to use the rails executable from the gem with version 4.2 on your command line.
Rubygems doesn't resolve approximate versions here. Instead, you have to specify the exact version you want to use (or omit the version from the command line to use the executable from the newest version of the gem installed.
Thus, you can use
rails _4.2.7.1_ new my_app
or (given that Rails 4.2.7.1 is the newest version of the rails gem installed to your computer), you can also just use
rails new my_app
I can't believe I could not figure this out and I have been spending needlessly too long. I used to use rails v. 5.0.0.1. Somehow when I was cloning apps from railscasts, I switched my rails to 3.1.0. Ever since then everytime I do rails new myApp it created rails v. 3.1.0..
I have a project folder name Project where I store all my rails app. When I typed rails -v in that Project folder, I get
Projects iggy$ rails -v
Rails 3.1.0
I just created new app named demo (rails new demo), and it generated a new app with rails 3.1.0.
When I do gem list, this is what I got:
demo iggy$ gem list --local rails
*** LOCAL GEMS ***
autoprefixer-rails (6.5.3, 6.4.1, 6.4.0.2, 6.3.7, 6.3.6, 6.3.1)
coffee-rails (4.2.1, 4.1.1, 4.1.0, 3.1.1)
factory_girl_rails (4.7.0, 4.6.0, 4.5.0)
haml-rails (0.9.0)
jquery-rails (4.2.1, 4.1.1, 4.1.0, 4.0.4, 3.1.4)
less-rails (2.7.1)
pry-rails (0.3.4)
rails (5.0.0.1, 5.0.0, 4.2.7.1, 4.2.5, 4.2.4, 4.2.3, 3.1.0)
I have tried going to my app that uses rails 5, ran bundle update / bundle install, but whenever I go to Project folder, it always defaults back to rails 3.1.0. I use rvm.
How can I switch back to rails 5.0.0.1 so whenever I create new app it will use latest rails? Moreover in general, is it possible to seamlessly switch between different version of rails app? If so, how can I do that?
You can uninstall Rails, and re-install it, and reinstalling it will convert the version to the latest.
gem uninstall rails
gem install rails # To re-install it.
Edit:
If you do not want to uninstall Rails, you may need to create a new Gemset for using using Rails 5 throughout your project space. Here's how:
rvm gemset create rails-5.0.0
rvm use 2.2.2#rails-5.0.0 --default
Kindly replace 2.2.2 with the Ruby version that you would like to use, but it should be later than 2.2.2.
I am making an instagram application using rails, but I keep getting this error every time I start my application:
can't activate multi_json (~> 0.0.5, runtime) for ["instagram-0.8"],
already activated multi_json-1.0.3 for []
My rails version is 3.0.4 and instagram gem has been installed (gem install instagram). What am i doing wrong?
Thanx in advance!
You should use bundler to manage your dependencies, rather than using rubygems directly.
If you use bundler, then execute your scripts with bundle exec <usual command here>, for example, bundle exec rspec spec/.
Bundler deals with all these issues for you. You may have to uninstall the gems you have installed manually in order to get this error to go away, however.
$: /Users/dev/.rvm/gems/ruby-1.9.2-head#rails3/gems/sqlite3-ruby-1.3.1/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
Abort trap
It's seem that ruby is not the correct version (1.8.7) but :
$: ruby - v
$: ruby 1.9.2dev (2010-07-15 revision 28653) [x86_64-darwin10.4.0]
$: gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.0.beta4, 3.0.0.beta3)
actionpack (3.0.0.beta4, 3.0.0.beta3)
activemodel (3.0.0.beta4, 3.0.0.beta3)
activerecord (3.0.0.beta4, 3.0.0.beta3)
activeresource (3.0.0.beta4, 3.0.0.beta3)
activesupport (3.0.0.beta4, 3.0.0.beta3)
arel (0.4.0, 0.3.3)
builder (2.1.2)
bundler (0.9.26)
erubis (2.6.6)
i18n (0.4.1, 0.3.7)
mail (2.2.5)
memcache-client (1.8.5)
mime-types (1.16)
polyglot (0.3.1)
rack (1.1.0)
rack-mount (0.6.9)
rack-test (0.5.4)
rails (3.0.0.beta4, 3.0.0.beta3)
railties (3.0.0.beta4, 3.0.0.beta3)
rake (0.8.7)
rdoc (2.5.9)
sqlite3-ruby (1.3.1)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.8)
treetop (1.4.8)
tzinfo (0.3.22)
will_paginate (3.0.pre)
more info :
$: ~ dev$ ruby -v
ruby 1.9.2dev (2010-07-15 revision 28653) [x86_64-darwin10.4.0]
$ :~ dev$ rails -v
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18
Any ideas ?
Thanks very much :)
Had the same issue after moving to 1.9.2p0, but restarting the console on Snow Leopard did the trick. Seems rvm might have gotten confused.
Same problem for me on Snow Leopard; even though under rvm 1.9.2#rails3, I can see correct rails version number.
I have to use following command to use rails command:
ruby which rails g scaffold User name:string bio:text
Any solution?
I've finally found the reason. Looks like gem install rails is not managed to install the proper binary for rails in rvm. And rails is still references /usr/bin/rails, which have a #! line point to System ruby.
You can see it with:
head -1 `which rails`
which returns:
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Change that to:
#!/usr/bin/env ruby
will fix the problem. I don't know if this problem affect other executable scripts gem installs, but why gem not install rails to rvm's own bin path is a mystery to me. Anyway, this workaround do the dirty for me.
I Had the same problem when using ree-1.8.7-2011.03. (Ruby enterprise Edition)
I uninstalled the sqlite3 gems then I ran:
gem install sqlite3
and it worked. Note that the sqlite3-ruby gem now recommends to use 'sqlite3' now.
I don't know how this has happened in your case but it looks to me that Rails has tried to run with your system installed Ruby but is loading gems from a 1.9.2 load path. Very odd.
You see the correct Ruby version in your shell (RVM has precedence in the local path) but that's not apparently what Rails is being started with.
Check to see you how you are starting Rails and that you don't have paths or links or aliases messed up between Ruby versions
You might need to run
rvm reload
Same problem after a bunch of updates (rvm to 1.5.2 and ruby to 1.9.2-p180)
Console restart did not work for me, updating to rails 3.0.6 changed the error to a seg error of mysql2 instead of sqlite3, re-installing mysql2 did the trick for me finally.
Regards
Michael
I encountered this exact error in zsh and MacVim, and eventually tracked it back to this RVM issue. The solution was to move the RVM sourcing I had in .zshrc to .zshenv. Worked immediately. Just posting on the off chance someone stumbles across this the way I did.
There is a known issue with zsh, rvm and vim.
The latest solution is to set the shell to sh in your .vimrc
set shell=sh
This blog has all the solutions listed