2017-10-24 10 views
0

this tutorial about Shopify Apps을 따르려고합니다.pg (0.21.0)를 설치하는 동안 오류가 발생했으며 Bundler를 계속할 수 없습니다.

bundle install

를하지만 나에게이 오류

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /tmp/bundler20171024-12759-18v2l7apg-0.21.0/gems/pg-0.21.0/ext 
/usr/bin/ruby2.3 -r ./siteconf20171024-12759-2yizk4.rb extconf.rb 
checking for pg_config... yes 
Using config values from /usr/bin/pg_config 
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for 
building a client-side application. 
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for 
building a client-side application. 
checking for libpq-fe.h... no 
Can't find the 'libpq-fe.h header 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary 
libraries and/or headers. Check the mkmf.log file for more details. You may 
need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/bin/$(RUBY_BASE_NAME)2.3 
    --with-pg 
    --without-pg 
    --enable-windows-cross 
    --disable-windows-cross 
    --with-pg-config 
    --without-pg-config 
    --with-pg_config 
    --without-pg_config 
    --with-pg-dir 
    --without-pg-dir 
    --with-pg-include 
    --without-pg-include=${pg-dir}/include 
    --with-pg-lib 
    --without-pg-lib=${pg-dir}/lib 

To see why this extension failed to compile, please check the mkmf.log which can be found here: 

    /tmp/bundler20171024-12759-18v2l7apg-0.21.0/extensions/x86_64-linux/2.3.0/pg-0.21.0/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /tmp/bundler20171024-12759-18v2l7apg-0.21.0/gems/pg-0.21.0 for 
inspection. 
Results logged to 
/tmp/bundler20171024-12759-18v2l7apg-0.21.0/extensions/x86_64-linux/2.3.0/pg-0.21.0/gem_make.out 

An error occurred while installing pg (0.21.0), and Bundler cannot continue. 
Make sure that `gem install pg -v '0.21.0'` succeeds before bundling. 

In Gemfile: 
    pg 

을 제공하지만 시도하는 경우 : 먼저 나는 시도

:

gem install pg -v '0.21.0'

는 또한 나에게 오류를 제공

Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. current directory: /var/lib/gems/2.3.0/gems/pg-0.21.0/ext /usr/bin/ruby2.3 -r ./siteconf20171024-12993-1t8i3d6.rb extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/$(RUBY_BASE_NAME)2.3 --with-pg --without-pg --enable-windows-cross --disable-windows-cross --with-pg-config --without-pg-config --with-pg_config --without-pg_config --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib To see why this extension failed to compile, please check the mkmf.log which can be found here: /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.21.0/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /var/lib/gems/2.3.0/gems/pg-0.21.0 for inspection. Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.21.0/gem_make.out 

나는

sudo apt-get install libpq-dev

은 ... 예, 오류를 작동하지만해야 읽었습니다 : 나는 우분투 16.04 LTS 일하고

Building dependency tree  
Reading state information... Done 
Some packages could not be installed. This may mean that you have 
requested an impossible situation or if you are using the unstable 
distribution that some required packages have not yet been created 
or been moved out of Incoming. 
The following information may help to resolve the situation: 

The following packages have unmet dependencies: 
libpq-dev : Depends: libssl-dev but it is not going to be installed 
E: Unable to correct problems, you have held broken packages. 

. (이것은 gemfile입니다 :)

source 'https://rubygems.org' 

git_source(:github) do |repo_name| 
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 
    "https://github.com/#{repo_name}.git" 
end 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.1.4' 
# Use postgresql as the database for Active Record 
gem 'pg', '~> 0.18' 
# Use Puma as the app server 
gem 'puma', '~> 3.7' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.2' 
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 
gem 'turbolinks', '~> 5' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.5' 
# Use Redis adapter to run Action Cable in production 
# gem 'redis', '~> 3.0' 
# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 
    # Adds support for Capybara system testing and selenium driver 
    gem 'capybara', '~> 2.13' 
    gem 'selenium-webdriver' 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 
    gem 'web-console', '>= 3.3.0' 
    gem 'listen', '>= 3.0.5', '< 3.2' 
    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 
    gem 'spring' 
    gem 'spring-watcher-listen', '~> 2.0.0' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 
gem 'shopify_app', '~> 7.0.0' 

어떻게해야합니까? 고맙습니다.

답변

3

나는 당신이,/페이지 루비 관련되지는 libssl-dev를 설치하려면 해결해야 문제의 이유는 여기

libpq-dev : Depends: libssl-dev but it is not going to be installed 

믿고 있지만 제대로 페이지 보석을 설치하는 것이 필요합니다.

0

--database=postgresql 옵션이 켜져있는 Mac (레일 5, 하이 시에라)에서 "rails new"명령을 실행했을 때 실행되었습니다. 이것은 초기 답변에서 언급 한 것들을 다시 말하지만, 도움이 될 것이라고 생각합니다. 문제는 내가 응용 프로그램 폴더에 응용 프로그램으로 Postgres를 설치했기 때문이며 "새로운 레일"명령이 실행되면 pg gem을 설치하는 데 필요한 포함을 찾을 수 없습니다. 내가해야 할 일은 시스템에 그들이 어디에 있는지 알려주는 것뿐입니다. 그래서 터미널이 실행 :

export CONFIGURE_ARGS=“with-pg-include=Applications/Postgres.app/Contents/Versions/latest/include/“ 

그럼 난 밖으로 문제를 실행할 수 있습니다 :

rails new MyAppName --database=postgresql