我很确定这是一个PATH
问题,但我在试图解决问题的最后阶段。希望其中一位巫师能够提供帮助。以下是一些相关信息:
System: Ubuntu 16.04 LTS running on Cloud
Environment Manager: Chef 12.21.3
rbenv version 0.4.0 installed via Chef ruby_rbenv cookbook
bundler version: 1.15.1 installed via ruby_rbenv LWRP systemwide
libpq-dev: INSTALLED
ruby-build: INSTALLED
PostGreSQL-9.5: INSTALLED
Alterations to .bashrc? NO
Alterations to PATH in capistrano? NO
Thus far I have been able to do everything through set directives in capistrano
现在有趣的东西
source 'https://rubygems.org'
ruby '2.3.4'
# admin UI gem
gem "activeadmin", :github => "activeadmin"
# This was the default encoder used by ActiveSupport prior to Rails 4.1
gem 'activesupport-json_encoder'
# Error handling gem, leave on v4, migration effort required to go to v5
gem 'airbrake', '4.3.6'
# AngularJS-style CSRF Protection for Rails
gem 'angular_rails_csrf'
# Required by 'has_secure_password'
gem 'bcrypt-ruby'
# Remote site scripting
gem 'capybara'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails'
# user authentication
gem 'devise'
# http library for api requests
gem 'faraday_middleware'
# forecast.io weather API
gem 'forecast_io'
# Find lat/long of businesses, currently just used for weather lookups.
gem 'geocoder'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder'
# email handling
gem 'mail'
# Facilitates communciation with Redis
gem 'message_bus'
# JS based charting library
gem 'morrisjs-rails'
# site performance monitoring
gem 'newrelic_rpm'
# html/xml parser
gem 'nokogiri'
# A Ruby wrapper for the OAuth 2.0 specification.
gem 'oauth2'
# Use Postgresql as the database for Active Record
gem 'pg'
# Application server
gem 'puma'
# PhantomJS in the gemfile for access through bundle exec
gem 'phantomjs', :require => 'phantomjs/poltergeist'
# JS based scripting gem for Capybara
gem 'poltergeist'
# force ssl connection
gem 'rack-ssl-enforcer'
# JS vector graphics
gem 'raphael-rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.6'
# Use SCSS for stylesheets
gem 'sass-rails'
# Background job processing
gem 'sidekiq'
# process monthly payments
gem 'stripe'
# allow switching between users
gem 'switch_user'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
gem 'redis-namespace'
gem 'yelp'
gem 'net-ssh'
gem 'fast-stemmer'
# bundle exec rake doc:rails generates the API under doc/api.
group :doc do
gem 'sdoc', '~> 0.4.0'
end
group :development do
# These two gems let us send exceptions to slack, if configured.
gem 'exception_notification'
gem 'slack-notifier'
gem 'capistrano'
gem 'capistrano-rbenv'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'capistrano3-puma'
gem 'capistrano-sidekiq'
gem 'capistrano-faster-assets'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
# suppress asset pipeline logs
gem 'quiet_assets'
# Generates ERDs with 'rake erd'
gem 'rails-erd'
# load env variables from .env file
gem 'dotenv-rails'
# debugging gems
gem 'better_errors'
gem 'binding_of_caller'#, platforms: [:mri_19, :mri_20, :rbx]
gem 'pry-byebug'
gem 'pry-doc'
gem 'pry-rails'
gem 'pry-remote'
end
group :test do
gem 'database_cleaner'
gem 'email_spec'
gem 'factory_girl_rails'
gem 'faker'
gem 'rspec-rails'
gem 'timecop'
end
group :production do
end
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Make sure that we have the library for rails included
require "capistrano/rails"
# Since we use Sidekiq, we need to gracefully stop processing jobs
# during a new deployment, and start accepting jobs when the deployment
# is complete as worker logic might change.
require "capistrano/sidekiq"
# Puma Requirements.
require 'capistrano/puma'
# Dynamic NGINX configuration
require 'capistrano/puma/nginx'
# We use rbenv
require 'capistrano/rbenv'
# We use Bundler
require 'capistrano/bundler'
# Configure Capistrano to use GIT for project management
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
set :rbenv_type, :system
set :bundle_flags, "--deployment --quiet --binstubs --shebang ruby-local-exec"
set :bundle_path, -> { shared_path.join('bundle') }
set :linked_files, %w{config/database.yml}
# Even in staging, we're testing against the production settings... that's the point.
set :rails_env, :production
# clean up old assets after each deploy,
# set this to the number of versions to keep
set :keep_assets, 2
# Rails handles this through its framework migrations.
set :migration_role, :app
# Defaults to the primary :db server
# However, by setting it up like this, the role handling the migration is the one that runs
# the rake db:migrate command.
set :migration_servers, -> { primary(fetch(:migration_role)) }
set :conditionally_migrate, true
set :assets_roles, [:web]
# Defaults to 'assets'
# This should match config.assets.prefix in your rails config/application.rb
# ... but we don't have that configuration option set. A lot of reading I did pointed
# to the inclusion of this command, but I am going to leave it out on the premise that
# we do not have the config.assets.prefix set for a good reason. If this changes,
# then uncomment the following line:
# set :assets_prefix, 'prepackaged-assets'
# If you need to touch public/images, public/javascripts, and public/stylesheets on each deploy
#set :normalize_asset_timestamps, %w{public/images public/javascripts public/stylesheets}
01 /usr/local/rbenv/bin/rbenv exec bundle install --path <OMITTED>/shared/bundle --without development test --deployment --quiet --binstubs --shebang ruby-local-exec
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last (more than 20) lines:
/usr/local/rbenv/bin/rbenv exec bundle install --path <OMITTED>/shared/bundle --without development test --deployment --quiet --binstubs --shebang ruby-local-exec
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
<OMITTED>/shared/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
/usr/local/rbenv/versions/2.3.4/bin/ruby -r ./siteconf20170711-55875-b7vll7.rb
extconf.rb --with-pg_config=/usr/bin/pg_config
Using config values from /usr/bin/pg_config
sh: 1: /usr/bin/pg_config: not found
sh: 1: /usr/bin/pg_config: not found
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
<SNIP>
extconf failed, exit code 1
Gem files will remain installed in
<OMITTED>/shared/bundle/ruby/2.3.0/gems/pg-0.18.4 for inspection.
Results logged to
<OMITTED>/shared/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.18.4/gem_make.out
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
In Gemfile:
pg
Relevant:
find_executable: checking for pg_config... -------------------- yes
--------------------
find_header: checking for libpq-fe.h... -------------------- yes
< The rest of this is too large to put here. It is available on request>
cat ./shared/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.18.4/gem_make.out
current directory: <OMITTED>/shared/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
/usr/local/rbenv/versions/2.3.4/bin/ruby -r ./siteconf20170707-35742-1cvk2th.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... yes
checking for rb_hash_dup()... yes
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for ruby/st.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
<OMITTED>/shared/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.18.4/mkmf.log
current directory: <OMITTED>/shared/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
make "DESTDIR=" clean
current directory: <OMITTED>/shared/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
make "DESTDIR="
compiling pg_type_map_by_mri_type.c
compiling pg_coder.c
compiling pg_type_map_by_column.c
compiling pg_result.c
compiling pg_type_map_in_ruby.c
compiling pg_errors.c
compiling pg.c
compiling util.c
compiling pg_type_map_by_class.c
compiling pg_copy_coder.c
compiling pg_type_map.c
compiling pg_text_encoder.c
compiling pg_binary_encoder.c
compiling pg_connection.c
pg_connection.c: In function ‘wait_socket_readable’:
pg_connection.c:2394:3: warning: implicit declaration of function ‘gettimeofday’ [-Wimplicit-function-declaration]
gettimeofday(&currtime, NULL);
^
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_oid.c
compiling gvl_wrappers.c
compiling pg_text_decoder.c
compiling pg_binary_decoder.c
linking shared-object pg_ext.so
current directory: <OMITTED>/shared/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
make "DESTDIR=" install
/usr/bin/install -c -m 0755 pg_ext.so ./.gem.20170707-35742-11dgneo
dev@app-1:<OMITTED>/releases/20170711040154$ bundle install
The git source `git://github.com/activeadmin/activeadmin.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using sass 3.4.22
Using thor 0.19.1
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using formtastic_i18n 0.6.0
Using mime-types 2.99.1
Using arel 6.0.3
Using concurrent-ruby 1.0.1
Using bundler 1.15.1
Using tilt 2.0.2
Using multi_json 1.12.1
Using bcrypt 3.1.11
Using addressable 2.4.0
Using orm_adapter 0.5.0
Using multipart-post 2.0.0
Using hashie 3.4.6
Using geocoder 1.3.3
Using redis 3.2.2
Using newrelic_rpm 3.15.1.316
Using jwt 1.5.1
Using multi_xml 0.5.5
Using pg 0.18.4
Using puma 3.4.0
Using phantomjs 2.1.1.0
Using cliver 0.3.2
Using websocket-extensions 0.1.2
Using rack-ssl-enforcer 0.2.9
Using raphael-rails 2.1.2
Using connection_pool 2.2.0
Using unf_ext 0.0.7.2
Using netrc 0.11.0
Using switch_user 1.2.1
Using simple_oauth 0.3.1
Using net-ssh 3.1.1
Using fast-stemmer 1.0.2
Using rails_serve_static_assets 0.0.5
Using rails_stdout_logging 0.0.5
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using bourbon 4.2.6
Using coffee-script 2.4.1
Using uglifier 3.0.0
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using warden 1.2.6
Using mail 2.6.4
Using sprockets 3.6.0
Using airbrake 4.3.6
Using bcrypt-ruby 3.1.5
Using faraday 0.9.2
Using message_bus 1.1.1
Using redis-namespace 1.5.2
Using websocket-driver 0.6.3
Using sidekiq 4.1.1
Using unf 0.1.4
Using rails_12factor 0.0.3
Using sdoc 0.4.1
Using activesupport 4.2.6
Using loofah 2.0.3
Using xpath 2.0.0
Using faraday_middleware 0.10.0
Using forecast_io 2.0.1
Using oauth2 1.1.0
Using domain_name 0.5.20160310
Using arbre 1.0.3
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.6
Using activesupport-json_encoder 1.1.0
Using jbuilder 2.4.1
Using rails-html-sanitizer 1.0.3
Using capybara 2.7.0
Using yelp 2.1.2
Using http-cookie 1.0.2
Using rails-dom-testing 1.0.7
Using activejob 4.2.6
Using activerecord 4.2.6
Using poltergeist 1.9.0
Using rest-client 1.8.0
Using actionview 4.2.6
Using polyamorous 1.3.0
Using stripe 1.42.0
Using actionpack 4.2.6
Using railties 4.2.6
Using formtastic 3.1.4
Using has_scope 0.6.0
Using kaminari 0.16.3
Using actionmailer 4.2.6
Using sprockets-rails 3.0.4
Using ransack 1.7.0
Using heroku_rails_deflate 1.0.3
Using coffee-rails 4.1.1
Using responders 2.1.2
Using jquery-rails 4.1.1
Using jquery-ui-rails 5.0.5
Using morrisjs-rails 0.5.1
Using rails 4.2.6
Using sass-rails 5.0.4
Using inherited_resources 1.6.0
Using devise 3.5.6
Using angular_rails_csrf 1.0.4
Using activeadmin 1.0.0.pre2 from git://github.com/activeadmin/activeadmin.git (at master@d84f819)
Bundle complete! 60 Gemfile dependencies, 111 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into <OMITTED>/shared/bundle.
我真的很难过。我一直试图让这台机器配置两天,并且能够完全无处可去。
感谢任何帮助。
答案 0 :(得分:0)
此问题与Chef部署rbenv
并安装bundler
以及执行ruby-build
的正确安装有关。通过手动配置VM并在其上启动部署过程解决了该问题。
答案 1 :(得分:-1)
您可以从服务器控制台尝试此命令:
sudo apt-get install libpq-dev build-essential postgresql-server-dev-9.5
然后尝试做
gem install pg