宝石安装 PG 不会捆绑



试图在Ubuntu 20上部署Rails应用程序是不可能安装pg的,任何捆绑的尝试都会导致错误

$ gem install pg
Building native extensions. This could take a while...
ERROR:  Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
/home/user/.rvm/rubies/ruby-2.6.1/bin/ruby -I /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210417-119158-37ke72.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 PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for PQresultVerboseErrorMessage()... yes
checking for PQencryptPasswordConn()... yes
checking for PQresultMemorySize()... yes
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile
current directory: /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
make "DESTDIR=" clean
current directory: /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
compiling pg_connection.c
compiling pg_copy_coder.c
compiling pg_errors.c
compiling pg_record_coder.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
compiling pg_tuple.c
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling pg_util.c
linking shared-object pg_ext.so
current directory: /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3/ext
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:201: .sitearchdir.time] Error 127
make install failed, exit code 2
Gem files will remain installed in /home/user/.rvm/gems/ruby-2.6.1/gems/pg-1.2.3 for inspection.
Results logged to /home/user/.rvm/gems/ruby-2.6.1/extensions/x86_64-linux/2.6.0/pg-1.2.3/gem_make.out

bundle install上似乎什么都不起作用:

安装bcrypt(3.1.16(时出错,Bundler无法继续。在绑定之前,请确保gem install bcrypt -v '3.1.16' --source 'https://rubygems.org/'成功。

在Gemfile中:bcrypt

安装nio4r(2.5.7(时出错,Bundler无法继续。在绑定之前,请确保gem install nio4r -v '2.5.7' --source 'https://rubygems.org/'成功。

在Gemfile中:rails被解析为6.1.3.1,这取决于actioncable被解析为6.1.3.1,这取决于nio4r

安装racc(1.5.2(时出错,Bundler无法继续。在绑定之前,请确保gem install racc -v '1.5.2' --source 'https://rubygems.org/'成功。

似乎什么都不起作用,也没有关于如何解决问题的有用信息

原因是make: /usr/bin/mkdir: Command not found

请使用sudo perm编写此命令。

sudo ln -s $(which mkdir) /usr/bin/mkdir

然后再试一次捆绑。

发生这种情况是因为您需要安装pg gem所需的以下软件包:

sudo apt install postgresql postgresql-contrib libpq-dev

然后配置postgres并验证是否正在运行。

相关内容

  • 没有找到相关文章

最新更新