ruby-on-rails - gem install 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
并再次尝试捆绑。
推荐阅读
- vue.js - vue-select v-model reduce 不工作 / Nuxt js Vue js
- html - 如何对齐冒号字符和文本?
- npm - node js cli STDOUT STDERR 输出 exec 和 spawn 命令
- php - 生成数组的所有组合,并不总是使用所有数组
- vue.js - 实时搜索组件
- yaml-front-matter - 将 og 图像添加到 VitePress
- postgresql - 更改 postgres 超级用户的身份验证方法
- batch-file - 如何让批处理文件打开文件浏览器以选择文件夹
- python - 如何使眼睛的投资回报率成为单个矩形
- powershell - PowerShell 在另一台服务器上运行计划任务