Rails can't find JSON gem but bundle install can? - ruby-on-rails

Just upgraded to OS X El Capitan and trying to create a new rails app for the first time since the upgrade. After a few hurdles (and alot of googling) I finally got the app created. When I try to create a new model using rails g model Mymodel I get this error:
Could not find json-1.8.3 in any of the sources
Run `bundle install` to install missing gems.
When I run bundle install I get this:
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
...
Bundle complete! 13 Gemfile dependencies, 54 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
When I run bundle show json I get:
/usr/local/lib/ruby/gems/2.2.0/gems/json-1.8.3
I know the basics of the rails setup but any troubleshooting like this has always been over my head. I imagine the solution is probably simple but by google searches haven't given me anything. Maybe I'm just not searching with the correct phrasing. Anyhow, does anyone have any idea what's going on and how to fix it?
Much appreciation!
UPDATE:
When I try to uninstall so I can reinstall I get the error:
ERROR: While executing gem ... (Gem::InstallError)
gem "json" cannot be uninstalled because it is a default gem
UPDATE 2:
The only thing I'm doing different than other new apps I've created is adding bootstrap. In my Gemfile I have:
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
I thought maybe one of them was causing the issue so I started by removing the autoprefixer gem from my Gemfile. I then ran the g model command and I got this error:
Could not find autoprefixer-rails-6.1.0.1 in any of the sources
Run `bundle install` to install missing gems.
which is the same as the previous error but with a different gem. So, I put the gem back into the Gemfile and I'm still getting that error. I have no idea what's going on. Any ideas?

Related

Ruby bundle install doesn't match Gemfile.lock: "Could not find json-1.8.6 in any of the sources"

I encountered a weird problem. In the Gemfile.lock, it states json (1.8.6).
Basically, I can use bundle install to install json-1.8.6.
However, it still threw the following error when I run rspec command.
Could not find json-1.8.6 in any of the sources
Run `bundle install` to install missing gems.
Bundler version 1.15.0
Ruby 2.3.3
Check your ruby source in gemfile should be: source 'https://rubygems.org'
or try adding the github path of the gem:
gem 'json', :git => 'https://github.com/flori/json.git'
Also try doing a bundle update.
If none of these work, please post your gemfile.
I have had similar problem recently and couldn't install one of the gems. I am not sure why, but I think it's because of the new Windows update (just a blind shot)
I have managed to repair it with reinstalling Ruby and devkit for it.
Good luck!

Rails could not find gem

when tried to start server rails s i have got
Could not find minitest-5.9.0 in any of the sources
Run `bundle install` to install missing gems.
i did gem install minitest -v 5.9.0
Successfully installed minitest-5.9.0
1 gem installed
also gem list
minitest (5.9.0, 4.7.5)
but when i try rails s again i received the same error.
How could i fix it?
bundle install
If you have tried that, try
bundle update
This will update your gems and your gemfile.lock
Best to specify the version you want in your Gemfile, at present you have 2 versions which will be causing the conflicts.
Something like gem 'minitest ', '~> 5.90' would do the trick. Once you have done this do bundle update this will ensure you update Gemfile to use the correct version of specified gem

I'm having trouble running my Rails web server

I have installed ruby193 and I've installed rails via the command prompt (I also installed a DevKit). However, whenever I try the command:
rails server
I get this error:
←[31mCould not find gem 'jquery-rails (>= 0) x86-mingw32' in the gems available
on this machine.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
I've tried a bundle install and it gives me an error with when trying to install the json gem. Any suggestions?
make sure in your Gemfile you are including the right gem (no misspellings, etc)
Looks like you are on Windows.
I defeated the very same problem on Windows by manually installing my gems from Gemfile (gem install gem_to_install). After successfully installing a particular gem I ran bundle check to see what else I need to install. And this way after few installed gems I ran bundle check again and saw the output The Gemfile's dependencies are satisfied.
And then server started. I wish you the same!
P.S. You can install few gems at once: gem install gem1 gem2.

How do I resolve a ZenTest-4.6.2 successfully installed & missing gem?

I'm loosely going through http://ruby.railstutorial.org/chapters/ and am at the point of preparing to test http://ruby.railstutorial.org/chapters/static-pages#sec:testing_tools . I listed the autotest related gems in my Gemfile and ran bundle install without incident, but when I tried to start the server I got the error Could not find ZenTest-4.6.2 in any of the sources. So I added ZenTest 4.6.2 to my Gemfile and reran bundle install.
Now according to my bash terminal, my bundle is complete including Using ZenTest (4.6.2), but when I try to start my server I'm still getting the error Could not find ZenTest-4.6.2 in any of the sources. So is it installed or is it not installed? And how should I resolve this conflict?
It should just say: gem "ZenTest" in your gem file, not the version # as well.

undefined method `call' for :err:Symbol after bundle update

After pulling my application, I noticed I had to run bundle install (I'm using rails 3 and ruby 1.9 at Ubuntu 10.10).
Bundler indicated a gem conflict and told me to bundle update. After that, my application broke giving me the following error:
https://gist.github.com/979975
At config/environment.rb:5, I only have
TopTal::Application.initialize!
I reinstalled rvm, ruby, ran bundle install again but the error still appears here. Does anyone have any idea?
Be careful with "bundle update"! When you ran it, bundler ignored the previously installed gems in Gemfile.lock and updated many or all of your gems. I suggest you revert your Gemfile and Gemfile.lock back to before you did the update and try bundle install again. Note the gem with the conflict and then do "bundle update gem_name". This should update only the gem with the problem.

Resources