Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find gem 'pg (= 0.12.4) ruby' in any of the gem sources listed in your Gemfile or available on this machine

I'm trying to run the following for on my Kali box, see error.

root@kali:~# ruby /usr/share/metasploit-framework/tools/nasm_shell.rb
Could not find rake-10.4.2 in any of the sources
Run `bundle install` to install missing gems.

I then run bundle install and get the below error:

Could not find gem 'pg (= 0.12.4) ruby' in any of the gem sources listed in your Gemfile or available on this machine.

The errors just keep on! Ive installed RVM since that was also an issue. Ive ran bundle update, no luck. ect..

my Gemfile is as follows:

 require 'pathname'

# During build, the Gemfile is temporarily moved and
# we must manually define the project root
if ENV['MSP_ROOT']
  root = Pathname.new(ENV['MSP_ROOT'])
else
  root = Pathname.new(__FILE__).parent
end
metamodules_load_path = root.join('metamodules', 'lib').expand_path.to_path

unless $LOAD_PATH.include? metamodules_load_path
  $LOAD_PATH.unshift metamodules_load_path
end

require 'metasploit/pro/metamodules'

source 'https://rubygems.org'

# All gems are listed alphabetically within their own group or sections.  When adding a gem please add a comment above
# the declaration explaining why the gem was added.

#
# Root
#

gemspec path: 'ui'
gemspec path: 'engine'
gemspec name: 'metasploit-framework-full', path: 'msf3'

Metasploit::Pro::Metamodules.gemspecs(self)

# We purchase and use RailsLTS which is slipstreamed into our build process.
# RailsLTS requires this publically available gem.
# Please note, installing this gem on its own does not install RailsLTS.
gem 'railslts-version', '>= 3.2.21'

# CSS helpers
gem 'compass'
# Make white listed rails routes available in javasript
gem 'js-routes'
# Delayed jobs on linux needs daemons
gem 'daemons', :platforms => :ruby
# Used to pass static data to javasript from Ruby
gem 'gon'
# Jbuilder for Builder-eque JSON templates
gem 'jbuilder'
# Javascript framework for the UI
gem 'jquery-rails', '~> 3.1.1'
# Pagination
gem 'kaminari', '~> 0.14.0'
# Metasploit credential models
gem 'metasploit-credential', '~> 0.14.5'


# Mdm models
gem 'metasploit_data_models', '~> 0.24.0'
# MIME type identification for files
gem 'mime-types', '1.18', :git => 'git://github.com/rapid7/mime-types.git'
# Adds to Rails 3 deprecated prototype JS helpers from Rails 2
gem 'prototype_legacy_helper', '0.0.0', :git => 'git://github.com/jvennix-r7/prototype_legacy_helper.git'
# RestClient needed for nexpose vuln verification
gem 'rest-client', '~> 1.6.7'
# parses robot.txt files for thin
gem 'robots', '0.10.1'
# TODO: REMOVE RSPEC!!!!!
# See https://jira.tor.rapid7.com/browse/MSP-10788
gem 'rspec'
# webserver
gem 'thin'
# treetop is needed by the mail gem, but for some reason isn't properly
# included when omitting development and test bundler groups
gem 'treetop'

#
# pcap group from metasploit-framework
#

# PCAPRUB
gem 'pcaprub', :git => 'git://github.com/bturner-r7/pcaprub.git', :branch => 'rapid7'
# Secure web headers and XSS defense-in-depth
gem 'secure_headers'


#
# Extension gems.
#

# JSON parsing
gem 'json'
# RPC library for API calls in controllers
gem 'msgpack'
# Parses HTML for webpage cloner
gem 'nokogiri'
# arel-helpers: Useful tools to help construct database queries with ActiveRecord and Arel.
gem 'arel-helpers'

#
# Windows-only gems used by prosvc.  All are extension gems, so they must be have fixed version to match pre-compiled
# gems.
#

# Dependency of windows-api
# version pinned to pre-installed version in ruby/lib
gem 'win32-api', '1.5.2', :platform => 'mingw'
# Allow thin to run as a Windows service in thin_service_install.rb
# version pinned to pre-installed version in ruby/lib
gem 'win32-service', '0.7.2', :platform => 'mingw'
# Dependency of windows-pr
# version pinned to pre-installed version in ruby/lib
gem 'windows-api', '0.4.3', :platform => 'mingw'
# Allows using windows calls as methods instead of as procs
# version pinned to pre-installed version in ruby/lib
gem 'windows-pr', '1.2.4', :platform => 'mingw'

#
# Groups - listed alphabetically
#

group :assets do
  # CoffeeScript integration in rails
  gem 'coffee-rails', '~> 3.2.2'
  # We have compile errors with >=1.5.  These can probably be fixed and this line removed.
  gem 'coffee-script-source', '< 1.5'
  # Compass CSS library in rails
  gem 'compass-rails', '1.0.1'
  # Coffeescript client-side templates
  gem 'eco', '1.0.0'
  # CoffeeScript to JavaScript conversion
  gem 'execjs', '1.3.0'
  # Handlebars integration in rails
  gem 'handlebars_assets'
  gem 'hamlbars', '~> 2.0.1'
  # Sass integration in rails
  gem 'sass-rails', '~> 3.2.4'
  # JavaScript virtual machine for execjs
  gem 'therubyracer'
  # JavaScript minification
  gem 'uglifier', '>= 1.0.3'
end

# DO NOT add debuggers or other debugging gems to the Gemfile.  The various debuggers will interfere with each other.
# gem 'debugger' specifically interferes with the 'ruby-debug-ide' gem installed by Rubymine.  As a courtesy to other
# developers using different debuggers, install and require your debuggers as needed using plain gem install and
# manually requiring the debugger file OR modify the Gemfile, but DO NOT commit the change.
group :development do
  # replaces standard error page with interactive stack and REPL in each stack frame.
  gem 'better_errors', '~> 0.9.0'
  # enables REPL and local/instance variable inspection for better_errors
  gem 'binding_of_caller'
  # static analysis security scanner for Rails.  Used on Jenkins.
  gem 'brakeman'
  # configuration tweaks for Rails 3.1+
  gem 'rails-dev-tweaks', '~> 0.6.1'
  # markdown formatting for yard
  gem 'redcarpet'
  # generate API documentation
  gem 'yard'
  gem "yard-cucumber"
  gem 'yard-restful', '~> 1.2.3'
  gem "rails-erd", :git => "git://github.com/lsanchez-r7/rails-erd.git"
  gem 'pry'
end

group :development, :test do
  # automatically load factories
  gem 'factory_girl_rails'
  # Needs to be in development as well as test so that `rake spec` works.
  gem 'rspec-rails', '2.14.2'
  # teaspoon is a javascript test runner for Rails
  gem "teaspoon"
  # Adding in awesome_print for better console output
  # colorizes and formats rails console, it can be added to your ~/.irbrc
  # require "awesome_print"; AwesomePrint.irb!.
  gem 'awesome_print'
  # Foreman to manage all the process we are starting to use
  gem 'foreman'
  # Using faker for development and testing of the nexpose integration
  gem 'faker'
  gem 'parallel_tests'
end

group :test do
  # Rails integrations for cucumber
  gem 'cucumber-rails', :require => false
  # this displayes the currently running step.
  gem 'slowhandcuke'

  gem 'capybara', '~> 2.2.1'
  gem 'capybara-firebug', '~> 2.0.0'
  gem 'capybara-json', '~> 0.3.0'
  gem 'ci_reporter'
  gem 'database_cleaner', '~> 0.8.0'
  gem 'fivemat'
  gem 'headless'
  gem 'msgpack-rpc', '~> 0.5.2'
  gem 'rbvmomi', :git => 'git://github.com/rapid7/rbvmomi.git', :branch => 'patches-1.8.1'
  gem 'rspec_junit_formatter'
  gem 'selenium-webdriver', '~> 2.44'
  # add matchers from shoulda, such as validates_presence_of, which are useful for testing validations
  gem 'shoulda-matchers'
  gem 'simplecov', :github => "colszowka/simplecov", :ref => "88a649aec0", :require => false
  gem 'simplecov-rcov'
  gem 'timecop', '~> 0.7'
  gem 'spork'
  gem 'webrat'
end

Please let me know how to resolve this issue!?

like image 492
rebecca oliveras Avatar asked Sep 10 '15 00:09

rebecca oliveras


People also ask

How do I set gem version in Gemfile?

There are several ways to specify gem versions: Use a specific version: gem "name-of-gem", "1.0" . You can find specific versions on Rubygems.org (provided that's the source you”re using) by searching for your gem and looking at the “Versions” listed. Use a version operator: gem "name-of-gem", ">1.0" .

How do I install bundles to install missing gems?

Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .

How do I install gems?

To install a gem, use gem install [gem] . Browsing installed gems is done with gem list . For more information about the gem command, see below or head to RubyGems' docs. There are other sources of libraries though.


2 Answers

You need to install libpq-dev first

sudo apt-get install libpq-dev

Then you can install gem pg via terminal

gem install pg

OR adding in Gemfile, you can add version if have any dependency

gem 'pg'
like image 112
Rokibul Hasan Avatar answered Oct 03 '22 23:10

Rokibul Hasan


Your gemfile does not seem to reference the pg gem directly. But the problem you are facing is that the repository https://rubygems.org does not have the pg gem version 0.12.4.

you can try adding a version that is present there

gem 'pg', '~> 0.12.2'

or a more recent version like '0.18.3' or '0.13.2'.

like image 27
The Fabio Avatar answered Oct 03 '22 21:10

The Fabio