我尝试跟随this tutorial about Shopify Apps。首先我尝试:
捆绑安装
"但它给了我这个错误"
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安装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安装libpq-dev
应该可以,但是,是的...错误:
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.
我正在Ubuntu 16.04 LTS上工作。(这是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'
我该怎么办?谢谢。
6条答案
按热度按时间qgzx9mmu1#
实际上这对我很有效
它要求我安装两个包
libpq-dev
和ruby-dev
yeotifhr2#
我认为您没有安装postgresql。请尝试:
72qzrwbm3#
我相信你的问题就在这里
你应该解决它来安装
libssl-dev
,它与ruby/pg无关,但它是他们正确安装pg gem所必需的。e7arh2l64#
尝试安装postgres:
brew安装后gresql
7z5jn7bk5#
我刚刚在Mac上运行“rails new”命令时遇到了这个问题(Rails 5,High-Sierra),并启用了
--database=postgresql
选项。但我认为它可能会有帮助。问题是因为我已经将Postgres作为一个应用程序安装在我的应用程序文件夹中,当“rails new”命令运行时,它不能'我找不到安装pg gem所需的include文件。我所要做的就是让系统知道它们在哪里。所以我在终端中执行了以下命令:这样我就可以在没有问题的情况下运行:
n53p2ov06#
可能是你忘了安装ruby-dev软件包。它帮我解决了这个问题。