Could Not Find Gem, but Gem is Installed without Problems - ruby-on-rails

Whenever I run the rails server or the specs, I get this error:
Could not find debugger-1.6.8 in any of the sources
When I run gem install debugger, it works just fine:
Building native extensions. This could take a while...
Successfully installed debugger-1.6.8
1 gem installed
Installing ri documentation for debugger-1.6.8...
Installing RDoc documentation for debugger-1.6.8...
(eval):5: warning: regular expression has ']' without escape: /\[a-z]+/
but the bundler list doesn't show debugger-1.6.8:
* daemons (1.2.3)
* delayed_job (4.0.3)
* delayed_job_active_record (4.1.0)
* diff-lcs (1.2.5)
* domain_name (0.5.25)
* double-bag-ftps (0.1.2)
I also don't have a .bundle/config file that is preventing any gems from being installed.
Here is my Gemfile with the :test and :development group:
group :test, :development do
gem 'sqlite3', '1.3.9'
gem 'rspec-rails', '~> 2.14.2'
gem 'pry'
gem 'awesome_print', '1.2.0'
gem 'debugger', platform: :mri_19
gem 'byebug' if RUBY_VERSION >= '2.0.0'
end
When i remove the platform specification, i get this error:
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.
I am running ruby 1.9.3-p551 with rbenv.
How do I get the debugger gem installed into the project bundle so I can run my server and tests?

Re-install your bundler gem and rbenv (via brew). Sometimes these installations can go bad, and the permissions on your machine will be sad when bundler and rbenv go to set your gems.

Related

Ruby error when running bundle install

When I run
rails s in the console, command fails and I get this response:
Could not find nokogiri-1.6.8.1 in any of the sources
Run bundle install to install missing gems.
First issue here is that nokogiri is not in my Gemfile because I'm not using nokogiri, so why is nokogiri an issue when it's not even part of the project where I'm running bundle install?
Then I run bundle install according to the initial prompt:
bundle install
I get an error. The final error message:
An error occurred while installing byebug (9.0.6), and Bundler cannot continue.
Make sure that gem install byebug -v '9.0.6' succeeds before bundling.
I noticed that throughout I get other errors that say:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
So, is this a problem with the Gemfile in my project or is it a deeper issue? Meaning the way the Gems are installed in my computer?
This is my Gemfile:
source "https://rubygems.org"
ruby "2.3.0"
gem "paperclip"
# Amazon web services
gem 'aws-sdk', '~> 2'
gem 'rails-erd'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'materialize-sass'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'hirb'
gem 'jquery-ui-rails'
# Use jquery as the JavaScript library
gem 'jquery-rails', '~> 2.2.2'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'activerecord-reset-pk-sequence'
gem 'acts-as-taggable-on'
gem 'simple_form'
gem 'rails_autolink'
gem 'perfect-scrollbar-rails'
gem 'rails_12factor'
gem 'pundit'
gem 'figaro'
# Use ActiveModel has_secure_password
# Use Unicorn as the app server
# gem 'unicorn'
group :production do
gem 'pg'
gem 'bcrypt'
gem 'whenever', require: false
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
#testing
gem 'capybara'
gem 'rspec-rails'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem "nifty-generators"
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'mocha', group: :test
This is the full response I get after running:
bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using rake 12.0.0
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.10.1
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 1.6.5
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Using activerecord-reset-pk-sequence 0.2.1
Using public_suffix 2.0.4
Using aws-sigv4 1.0.0
Using jmespath 1.3.1
Using bcrypt 3.1.11
Using debug_inspector 0.0.2
Installing byebug 9.0.6 with native extensions
Using choice 0.2.0
Using chronic 0.10.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using thor 0.19.4
Using concurrent-ruby 1.0.2
Using diff-lcs 1.2.5
Using hirb 0.7.3
Using multi_json 1.12.1
Using sass 3.4.22
Using metaclass 0.0.4
Using mimemagic 0.3.2
Using nifty-generators 0.4.6
Installing pg 0.19.0 with native extensions
Using bundler 1.13.6
Using ruby-graphviz 1.2.2
Using rails_serve_static_assets 0.0.5
Using rails_stdout_logging 0.0.5
Using rdoc 4.3.0
Using rspec-support 3.5.0
Using tilt 2.0.5
Installing sqlite3 1.3.12 with native extensions
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Installing nokogiri 1.6.8.1 with native extensions
Using rack-test 0.6.3
Using mime-types 3.1
Using addressable 2.5.0
Using aws-sdk-core 2.6.38
Using binding_of_caller 0.7.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
/usr/local/opt/ruby/bin/ruby -r ./siteconf20161217-12309-210wge.rb extconf.rb
creating Makefile
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
make "DESTDIR=" clean
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
make "DESTDIR="
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
make failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/byebug-9.0.6/gem_make.out
An error occurred while installing byebug (9.0.6), and Bundler cannot continue.
Make sure that `gem install byebug -v '9.0.6'` succeeds before bundling.
Ok, thank you for updating your question with the bundle output. The problem is that you don't have xcode's command line tools installed.
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
make "DESTDIR=" clean
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
make "DESTDIR="
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
make failed, exit code 1
To fix it just run in your command line:
xcode-select --install
This should fix it.

Error: Permission Denied # rb_sysopen when trying to install gem pg in my rails app (Windows 7)

Using windows 7 ultimate and running cmd as administrator.
I have recently started working with ruby on rails and in my new rails app I'm attempting to install postgres(pg) gem and then I get a permission denied error as shown below:
C:\wamp\www\RailsApp>bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/...........
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.8
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.8
Using rack 1.5.2
Using rack-test 0.6.3
Using actionpack 4.1.8
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.1.8
Using activemodel 4.1.8
Using arel 5.0.1.20140414130214
Using activerecord 4.1.8
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.8
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.6
Using jquery-rails 3.1.2
Errno::EACCES: Permission denied # rb_sysopen - C:/Ruby21/lib/ruby/gems/2.1.0/ge
ms/pg-0.18.1-x86-mingw32/lib/2.1/pg_ext.so
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
I have tried
gem install pg
which leads to the same error.
However... when I try
gem install pg -mingw32
It appears successfull:
C:\wamp\www\RailsApp>gem install pg -mingw32
Fetching: pg-0.18.1-x86-mingw32.gem (100%)
Successfully installed pg-0.18.1-x86-mingw32
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.18.1-x86-mingw32
Installing ri documentation for pg-0.18.1-x86-mingw32
Done installing documentation for pg after 16 seconds
1 gem installed
Though after searching through several posts I fail to find a solution to how I can implement this with the gemfile to make the bundler run without errors nor find a solution to why I get the permission denied error in the first place.
Here is my current gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
Note: I have tried using
gem 'pg', platform: :mingw
yet, the error still occurs.
Hope this helps as to make my problem clear and feel free to ask and I'll supply more data possible.
Any suggestions are valued and accepted, thank you.
If you are on windows, use thisgem install pg -mingw32
It looks like bundle is trying to install things in the
C:/Ruby21/lib/ruby/gems/2.1.0/ge
ms/pg-0.18.1-x86-mingw32/lib/2.1/
directory and your user (or the process that is executing bundle) does not have permission to write things to that particular directory.
I am no expert on bundle, but one troubleshooting step you could try is to run a windows command prompt as administrator explicitly. You can do this by searching for CMD, then right-clicking on it and selecting "run as administrator". This sometimes corrects file permissions issues when installing things in windows.

Rails console doesn't work (openshift)

I have been using openshift for a week now, and everything works fine. Unfortunately, neither with Ruby2.0 or Ruby1.9.3 can I access the Rails4 console online, which is a real problem.
bundle exec rails console RAILS_ENV="production"
fails, asking me to run bundle install, and bundle install fails, telling me it can't install active support 4.1.4, even though during deployment openshift says it is installed in .vendor/bundle. I tried deleted my app several times, recreating, starting with a clean version of the railsapp example on github... nothing works.
I hope you can help me, thanks in advance
[app-root/repo]$ bundle exec rails console RAILS_ENV="production"
bundler: command not found: rails
Install missing gem executables with `bundle install`
[app-root/repo]$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.6)
Using i18n (0.6.11)
Using json (1.8.1)
Using minitest (5.4.0)
Using thread_safe (0.3.4)
Using tzinfo (1.2.1)
Installing activesupport (4.1.4)
Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
An error occurred while installing activesupport (4.1.4), and Bundler
cannot continue.
Make sure that `gem install activesupport -v '4.1.4'` succeeds before
bundling.
[app-root/repo]$ gem install activesupport -v '4.1.4'
Fetching: i18n-0.6.11.gem (100%)
Successfully installed i18n-0.6.11
Fetching: thread_safe-0.3.4.gem (100%)
Successfully installed thread_safe-0.3.4
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: activesupport-4.1.4.gem (100%)
Successfully installed activesupport-4.1.4
4 gems installed
[app-root/repo]$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.6)
Using i18n (0.6.11)
Using json (1.8.1)
Using minitest (5.4.0)
Using thread_safe (0.3.4)
Using tzinfo (1.2.1)
Installing activesupport (4.1.4)
Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
An error occurred while installing activesupport (4.1.4), and Bundler
cannot continue.
Make sure that `gem install activesupport -v '4.1.4'` succeeds before
bundling.
I am using the Gemfile provided on Github, with minor changes. I had to modify the following lines a bit, or rails would complain:
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
had to be replaced by
group :development do
gem 'spring'
end
group :doc do
gem 'sdoc', '~> 0.4.0'
end
Just ask if you need more info.
I use
cd ~/app-root/repo && RAILS_ENV=production bundle exec rails console
And it works fine for me.
OpenShift is quite picky with the Gemfile format:
In my case it was:
gem 'guard-rspec', require: false
Has to be:
gem 'guard-rspec', :require => false
That fixed the first error, bundle was complaining about the file format, and then I had the problem of the gems not being there.
So again I connected to the console and did a gem install bundler in
app-deployment/current/repo
and
~/.gem/bin/bundle exec rails c
did work this time

Nokogiri gem installation error with spree

I'm getting this error when I try to bundle install
Bundler::GemspecError: Could not read gem at /home/theareba/.rvm/gems/ruby-2.0.0-p353/cache/nokogiri-1.6.1.gem. It may be corrupted.
An error occurred while installing nokogiri (1.6.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
I've tried removing nokogiri in the cache and bundle installing again in vain.
Here's my gemfile
source 'https://rubygems.org'
gem 'rails', '4.0.0'
ruby "2.0.0"
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-1-stable'
gem 'spree', github: 'spree/spree', branch: '2-1-stable'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder'
group :development, :test do
gem 'turn', :require => false
gem 'sqlite3'
gem 'taps', :require => false
gem 'rspec-rails'
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor'
end
UPDATE
Error that occurs when I run gem install nokogiri -v '1.6.0'
Fetching: mini_portile-0.5.2.gem (100%)
Fetching: nokogiri-1.6.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:5:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out
Note: I've installed both libxslt1-dev and libxml2-dev that are requirements in nokogiri installation.
I've also tried gem install nokogiri -v '1.6.1' but it still fails. I've installed nokogiri -v 1.5.0 in another app so I tried it in this app and got the error that spree requires nokogiri version 1.6.0 or greater. I'm I missing something?
So here's what solved my problem. I created a new gemset i.e
rvm gemset create nokogiri
rvm use ruby-2.0.0-p353#nokogiri
Note: I'm using rvm and ruby 2.0.0. Then I made sure I've got necessary lib installed by running
sudo apt-get install libxml2-dev libxslt-dev
The libraries happened to be already installed. Then I installed nokogiri
gem install nokogiri -v '1.6.1'
It installed successfully. And finally ran bundle install to get all my gems. Hope this helps anyone having the same issue.
Check the RVM gemset. I fixed it by restoring the gemset. If you try upgrading to 4.0.2? I used Nokogiri 1.6.1 with Ruby 2.0.0 and Rails 4.0.2
try this
sudo apt-get install ruby-dev
sudo apt-get install libxml2 libxml2-dev libxslt1-dev
and reinstall nokogiri
sudo gem install nokogiri

the therubyracer gem keeps causing bundle install to fail on ubuntu 12.04

I'm trying to use capistrano to deploy, and it fails because of a rubyracer gem issue.
I tried adding the following variants to gemfile and then deploying to a production server on ubuntu and nothing works:
1)
gem 'libv8', '3.11.8.3'
3)
gem 'therubyracer'
gem 'libv8', '3.3.10.4'
4)
gem 'libv8', '~> 3.11.8.3'
It all gives the same error:
An error occured while installing therubyracer (0.11.0), and Bundler cannot continue.
Make sure that gem install therubyracer -v '0.11.0' succeeds before bundling.
So I try this instead:
group :production do
gem 'therubyracer', '0.10.2', :platforms => :ruby
end
But that causes this error:
Bundler could not find compatible versions for gem "libv8":
In Gemfile:
therubyracer (= 0.10.2) ruby depends on
libv8 (~> 3.3.10) ruby
libv8 (3.11.8.3)
It seems I currently have two version of lib8 on server:
libv8 (3.11.8.4, 3.3.10.4 x86_64-linux)
Any ideas?
After hours of trying solutions from stackoverflow, I got an easy fix from this site with just 2 commands, the author mentioned that
When installing therubyracer gem you may run into this problem on a
fresh machine install.
http://usefulprogrammingshit.drmcnasty.com/?p=12
sudo apt-get install g++
sudo apt-get install build-essential
I know nothing of ruby so you would need to research more about this solution, but after all, "therubyracer 0.12.2" is installed on ubuntu 14.04. I hope it could help.
Just uninstall both libv8 from your machine
Terminal
gem uninstall libv8
In terminal, You will be prompt to select which version do you want to uninstall like this:
libv8 3.3.10.4 x86_64-linux
libv8 3.11.8.4 x86_64-linux
All
Select 3 and hit enter(return key). It will uninstall your both libv8 versions installed in your machine.
Now, in your Gemfile just include therubyracer without libv8 and bundle install
gem 'therubyracer'
bundle install
It will work
At the command line of the production server do
gem install therubyracer
try node.js as your runtime javascript environment, but not libv8.
if you insist on libv8, don't specify the version. it seems that there's conflicts on the versions. e.g. in your Gemfile:
gem 'therubyracer'
gem 'libv8'

Resources