rspec-support showing version issue - ruby-on-rails

When i try running the spec file of my rails application this error pops up
Could not find 'rspec-support' (~> 3.9.1) - did find: [rspec-support-3.6.0,rspec-support-3.5.0] (Gem::MissingSpecVersionError)
Checked in 'GEM_PATH=/Users/priyanshu.sahoo/.gem/ruby/2.7.0:/Users/priyanshu.sahoo/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0', execute gem env for more information
As this says it cant find rspec-support 3.9.1 so i install it. Then while running it again it shows another error saying it doesn't need 3.9.1.
You have already activated rspec-support 3.9.1, but your Gemfile requires rspec-support 3.6.0. Prepending bundle exec to your command may solve this. (Gem::LoadError)
This is my first time working with a rails application. Please help me out.

Related

bundle install error - ruby_dep-1.5.0 requires ruby version >= 2.2.5 but I have version 3.0.1p64

I used to work in a project with a Ubuntu machine flawlessly.
After some time, I decided to hop into Fedora and now that I've setup everything, I was going to continue the project but when I run bundle install I get the following:
➜ bundle install
Following files may not be writable, so sudo is needed:
/usr/bin
/usr/share/gems
/usr/share/gems/build_info
/usr/share/gems/bundler
/usr/share/gems/cache
/usr/share/gems/doc
/usr/share/gems/extensions
/usr/share/gems/gems
/usr/share/gems/plugins
/usr/share/gems/specifications
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies....
ruby_dep-1.5.0 requires ruby version >= 2.2.5, ~> 2.2, which is incompatible with the current version, ruby 3.0.1p64
Clearly my Ruby version requirement is met.
Should I downgrade it so I could continue?
If so, how to properly do it without rvm or rbenv?
I was able to find 2 lines with ruby_dep on Gemfile.lock and I'm not quite sure how to proceed. The first result is nested and the other isn't:
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
...
ruby_dep (1.5.0)
Should I keep one or change the version of both? I couldn't find ruby_dep anywhere else besides Gemfile.lock
I ran into the same issue.
One method is to delete your Gemfile.lock and run bundle install
This deletes all existing references to ruby_dep and gives you a fresh install of your gems.
Deleting the whole Gemfile.lock file (as suggested in another answer) might not be the best idea.
First, simply try to update the ruby_dep in your dependencies:
bundle update ruby_dep
When it says it requires sudo to install gems, it's because you're using the system Ruby (Ruby that your OS uses), and it's not a good idea to alter that.
Install a different version of Ruby and confirm it's set to that, then bundle.
Step-by-step
Add webrick gem to gemfile
Remove specific jekyll version number from gemfile. Leave only gem "jekyll"
Run bundler
Run bundle exec jekyll serve --livereload
Pay attention to ~> 2.2, it means 2.x, but not 3. Read more here https://bundler.io/gemfile.html

Rails keeps on asking me to "Please run `bundle install` before trying to start your application"

Everything was working fine, then all of a sudden I was not able to run "rails s" or "rails c" anymore.
I keep getting the following error msg:
The git source https://github.com/plataformatec/devise.git is not yet checked out.
Please run `bundle install` before trying to start your application
I have searched online and they said to run: spring binstubs --all, but this does not work and gives me the same error message as above.
Please help. Last thing I did was push a code to heroku and github. Rails server, console was working fine then this happens.
I have tried running bundle install, it outputs this error
...
Resolving dependencies...............
Bundler could not find compatible versions for gem "railties":
In snapshot (Gemfile.lock):
railties (= 5.0.4)
In Gemfile:
inherited_resources was resolved to 1.11.0, which depends on
railties (< 6.1, >= 5.2)
rails (~> 5.0.0) was resolved to 5.0.4, which depends on
railties (= 5.0.4)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Take note that I did not do any changes to anything, that's why its so weird. It was working 5minutes earlier then all of a sudden this occurs.
I have restarted my Mac already and issue still persists
From the stacktrace, I see the issue to be with the inherited_resources gem. If you look at the gemspec of this gem for v1.11.0 which you are currently using, you can see where it explicitly states >= 5.2 for railties. However, it appears you running rails 5.0.0 which is tied into 5.0.4 of railties.
To fix this, I suggest fixing the inherited_resources gem to v1.9.0 which can use railties 5.0.4 and then re-run bundle install
gem inherited_resources, "1.9.0"
I was able to fix just by simply uninstall and reinstalling my ruby and running bundle install
rbenv uninstall
rbenv install
gem install bundler
bundle install
rails s

Can't activate rack (~> 1.4.0, runtime) already activated rack-1.5.0

I've been looking for an answer to this for over a day now, and searched StackOverflow thoroughly.
I understand the conflict that's happening, and I should just uninstall the version of Rack I don't need, but here's the thing. I'm developing on Koding (http://koding.com) and I don't have access to system level gems.
Rails was working before, I installed the mongo gem, removed it, and installed mysql2 gem.
bash4.1$ rails
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:233:in `activate': can't activate rack (~> 1.4.0, runtime) for ["actionpack-3.2.11", "railties-3.2.11"
], already activated rack-1.5.0 for ["rack-ssl-1.3.2", "railties-3.2.11"] (Gem::LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `
from /usr/bin/rails:18
I've wiped my directory clean, tried using RVM, and still nothing. Any ideas?
Thanks!
Use Bundler to resolve the Rack dependency according to the app Gemfile.
$ bundle exec rails
Otherwise, delete Rack 1.5.0 and retry.
$ gem uninstall rack
# select the proper version to delete

can't activate multi_json (~> 0.0.5, runtime) for ["instagram-0.8"], already activated multi_json-1.0.3 for []

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.

What does this Cucumber error message mean?

I run cucumber features and get:
Using the default profile...
can't activate builder (~> 2.1.2, runtime) for
["activemodel-3.0.5", "actionpack-3.0.5", "railties-3.0.5"],
already activated builder-3.0.0 for
["cucumber-0.10.2"] (Gem::LoadError)
What is wrong here and how can I fix it? Thanks.
It means you have builder 3.0.0 installed and loaded while rails needs 2.1.x.
Try
$ gem uninstall builder
followed by
$ bundle
(assuming you're using bundler).
If you're not, do
$ gem install builder --version "<2.2"
HTH.

Resources