Rails: Bundle install not working - ruby-on-rails

I've generated the app with "rails new" and switched to that directory but when I try to use "bundle install" I get
An error occurred while installing debug_inspector (0.0.2), and Bundler cannot
continue.
Make sure that gem install debug_inspector -v '0.0.2' succeeds before
bundling.
any suggestions?

I had the same problem with my rails application. I'm running with JRuby on my Windows machine and this is a common problem for Windows. I had to find the gem which included that gem as a dependency and remove it from my gem file.
In my case, there was a gem causing this name : gem 'web-console', '2.0.0.beta3' (probably an old version of the gem since it's a 1 year old project).
You probably need to comment some gem and try to bundle until it works.
If the gem is essential to the project, you will have to find a way to compile the gem for windows.
It may exist a way to check a tree of dependency to speed up the process.

This is a common error in older versions of ruby. Updating ruby version to 2.1.0 or later will fix this issue.

Related

Rails: Bundle Install fails to install necessary gem after downloading from github

I have cloned from my github account a repo, I am getting the following error, when i run bundle install. i cant understand the reason for it. The repo had been pushed from my pc and now i am cloning it to my laptop
An error occurred while installing sassc (2.2.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.2.1' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
sass-rails was resolved to 6.0.0, which depends on
sassc-rails was resolved to 2.1.2, which depends on
sassc
This is a known issue:
https://github.com/sass/sassc-ruby/issues/153
Solution:
add gem 'sassc', '~> 2.1.0' to your gemfile.
run bundle install
This will force it to use sassc version 2.1.0 which doesn't have the compile issue with Rails 6.
As a tip, whenever a gem fails to install or conflicts with another gem, it's a good idea to go check out the gem itself. 99% of the time, the code is on GitHub.
If you're new to this, try following these steps:
Gems in your gemfile come from https://rubygems.org by default, so visit that site and search for the gem exactly as it's named in your gemfile. In this case, it's here: https://rubygems.org/gems/sassc
On the gem's info page, find links on the righthand side. Click 'homepage'. For sassc, it takes you to this URL: https://github.com/sass/sassc-ruby
Click on the issues tab and look for anything related to the thing you're struggling with. In this case, I found about 3. Read through those issues and see if people have posted solutions or work-arounds.
Happy gem hunting!

Problem when installing rails on windows?

I am trying to create new demo rails program, as guide in my book as this command
rails new demo
then it gave me this error
https://imgur.com/rUSzO4B
It said that my problem is
Could not find gem sqlite3 <> 1.4 x86-mingw32 in any of the gem sources listed in your Gem file
and I must run
bundle install
to solve it
I ran bundle install , but nothing changed.
I know my question maybe too easy to solve, but I am very stuck with this, could you please give me some ideas?
From the documentation of the bootsnap gem in rails: "This gem works on macOS and Linux." See: https://github.com/Shopify/bootsnap
They seem to have found a workaround here:
How can I properly install bootsnap on windows
Add or change to gem 'bootsnap', '=1.4.1', require: false to your project Gemfile

Ruby - Install Sinatra gem error on ruby mine

I'm working on a new project in Ruby, which I'm learning, and I need to install Sinatra gem and I'm getting the following error:
"Following gems were not installed: sinatra-sinatra (0.10.1): While
executing gem ... (Gem::UnsatisfiableDependencyError)
Unable to resolve dependency: 'sinatra-sinatra (= 0.10.1)' requires 'rack (>= 1.0)'"
Currently I'm using, RubyMine (Windows). Any help would be appreciated.
Thanks
The problem is not RubyMine, but some other dependency conflict in your app. The gem sinatra-sinatra requires Rack 1.0, there is probably another gem in your Gemfile that requires a greater or different version of the same gem.
Actually, I believe your problem can easily be fixed by using the proper gem. sinatra-sinatra is a very old gem, if you want to use the Sinatra framework the correct gem is sinatra. Update your Gemfile accordingly.
In you machine
gem install sinatra-sinatra
Check you Gemfile
gem 'sinatra-sinatra', '~> 0.10.1'
Delete the Gemfile.lock and bundle its once again.

Connect rails to Sql Server

I am trying to connect Rails to Sql Server so I need to use an Sql Server adaptor. I installed it by downloading the adaptor locally from github.com/Desarrollo-CeSPI/activerecord-sqlserver-adapter.git. After that I did: gem build activerecord-sqlserver-adapter.gemspec in the directory where I had the spec file, followed by gem install <name of gem that was just built>.
After that, I added this line in the gemfile:
gem 'activerecord-sqlserver-adapter', :path => 'downloads/activerecord-sqlserver-adapter-master\activerecord-sqlserver-adapter-master' , then I ran a bundle install from the project root.
The error is:
Bundler could not find compatible versions for gem "activerecord": In
Gemfile: rails <=4.1.6> x86-mingw32 depends on activerecord <=4.1.6>
x86-mingw32
activerecord-sqlserver-adapter <>=0> x86-mingw32 depends on
activerecord <4.0.0>
What is strange is rails -v doesn't return the rails version although I just installed it.
Instead it throws:
Could not find gem 'tzinfo-data <>=0> x86-mingw32 in the gems available on this machine
Run bundle install to install missing gems
I should specify we are compulsed to use proxies at work
Every few month I keep checking to see if the Sql Server connection is improved/easier to perform with Rails without adaptors and such, because I want to use Sql Server instead of PostgreSQL. No luck so far. Any help is much appreciated. Thanks
It looks like the gem that you are using only supports until rails 4.0.0 (the gemspec forces to be this version).
You might try to use that rails version to see what's going on.
To do so, in your Gemfile.rb you can try this:
gem 'rails', '4.0.0'
gem 'activerecord-sqlserver-adapter', git: 'https://github.com/Desarrollo-CeSPI/activerecord-sqlserver-adapter.git'
and then run
bundle update rails # to force using the rails version specified in the gemfile
and then run
bundle install
BUT
The gem that you are using has not been updated since 22nd August 2013, so I would not expect it work.
The gem that you are using is a fork of the original project located at https://github.com/rails-sqlserver/activerecord-sqlserver-adapter
If you don't have anything to do with Desarrollo-CeSPI, then you should use the official gem to avoid some problems, for instance that the gem is not maintained anymore.

i'm unable to install gem debugger on rails 4.1.1

ruby version is 2.1.0 and rails version is 4.1.1
my gem file got like below
gem 'debugger'
when i run command bundle install, i get error like below:
##
An error occurred while installing debugger (1.6.8), and Bundler cannot continue.
Make sure that gem install debugger -v '1.6.8' succeeds before bundling.
##
seeking suggestion to solve the issue.
debugger isn't compatible with Ruby 2 and above, it's a known issue.
https://github.com/cldwalker/debugger/issues/125#issuecomment-43353446
The author recommends using byebug or debugger2 instead.
This Worked for me:
Please replace
gem 'pry-debugger'
with
gem 'pry-byebug'
Thanks!
Debugger is not fully supported for Ruby 2.x.x.
Issue#118 is popular issue which addresses the same. Though it mentions that debugger 1.6.6 must be supported by Ruby 2.1.1, the users are still encountering the similar errors as you are.
Also, this is especially mentioned in their known issues.
You can try to follow that discussion to troubleshoot your problem.
Additionally, this may help:
rm Gemfile.lock
gem install debugger-ruby_core_source
gem update
bundle install
The other solution in issue discusses the possibility of updating Ruby binary.
If nothing works, and if you can possibly change the ruby/rails versions, I can suggest my current combination:
ruby 2.0.0-p195
rails 4.0.0
They work perfectly fine with debugger gem.
debugger gem doesn't work with Ruby 2.1+. Instead try byebug.

Resources