Error handling 如何在没有sudo权限的情况下安装libpq-dev?

Error handling 如何在没有sudo权限的情况下安装libpq-dev?,error-handling,command-line,terminal,rubygems,sudo,Error Handling,Command Line,Terminal,Rubygems,Sudo,我已通过ssh连接到远程服务器(我不是该服务器的管理员),我正在尝试运行bundle安装并获取以下信息: [<user_name>@<name> <folder>]$ bundle install Fetching gem metadata from https://rubygems.org/.......... Fetching gem metadata from https://rubygems.org/. Resolving dependencies..

我已通过ssh连接到远程服务器(我不是该服务器的管理员),我正在尝试运行bundle安装并获取以下信息:

[<user_name>@<name> <folder>]$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...................
Using concurrent-ruby 1.1.8
Using i18n 1.8.9
Using minitest 5.14.4
Using tzinfo 2.0.4
Using zeitwerk 2.4.2
<...lots more gems...>
Using gli 2.20.0
Using hashie 4.1.0
Using json 2.5.1
Using mini_portile2 2.5.0
Using mysql2 0.5.3
Using racc 1.5.2
Using nokogiri 1.11.2 (x86_64-linux)
Fetching pg 1.2.3
Installing pg 1.2.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/<user_name>/<folder>/vendor/bundle/ruby/2.7.0/gems/pg-1.2.3/ext
/usr/local/rvm/rubies/ruby-2.7.1/bin/ruby -I /usr/local/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20210419-1690-38pae5.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
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/local/rvm/rubies/ruby-2.7.1/bin/$(RUBY_BASE_NAME)
    --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:

  /home/<user_name>/<folder>/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/pg-1.2.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/<user_name>/<folder>/vendor/bundle/ruby/2.7.0/gems/pg-1.2.3 for inspection.
Results logged to /home/<user_name>/<folder>/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/pg-1.2.3/gem_make.out

An error occurred while installing pg (1.2.3), and Bundler cannot continue.
Make sure that `gem install pg -v '1.2.3' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  pg
[<user_name>@<name> <folder>]$ gem install pg -v '1.2.3' --source 'https://rubygems.org/'
Fetching pg-1.2.3.gem
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/local/rvm/gems/ruby-2.7.1 directory.
[@]$bundle安装
从中获取gem元数据https://rubygems.org/..........
从中获取gem元数据https://rubygems.org/.
解决依赖关系。。。。。。。。。。。。。。。。。。。
使用并发ruby 1.1.8
使用i18n 1.8.9
使用minitest 5.14.4
使用tzinfo 2.0.4
使用zeitwerk 2.4.2
使用gli2.20.0
使用hashie 4.1.0
使用json 2.5.1
使用mini_portile2 2.5.0
使用mysql20.5.3
使用racc 1.5.2
使用nokogiri 1.11.2(x86_64-linux)
取数第1.2.3页
使用本机扩展安装第1.2.3页
Gem::Ext::BuildError:错误:无法生成Gem本机扩展。
当前目录:/home///vendor/bundle/ruby/2.7.0/gems/pg-1.2.3/ext
/usr/local/rvm/rubies/ruby-2.7.1/bin/ruby-I/usr/local/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0-r./siteconf20210419-1690-38pae5.rb extconf.rb
正在检查pg_配置。。。不
没有pg_配置。。。无论如何都要努力。如果构建失败,请使用重试
--使用pg config=/path/to/pg_config
正在检查libpq fe.h。。。不
找不到'libpq fe.h标头'
***extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少必要的
库和/或标题。有关详细信息,请查看mkmf.log文件。你可以
需要配置选项。
提供的配置选项:
--使用opt dir
--不带opt dir
--选择包含
--不带opt include=${opt dir}/include
--使用opt lib
--不带opt lib=${opt dir}/lib
--用make prog
--没有make prog
--srcdir=。
--库尔迪尔
--ruby=/usr/local/rvm/rubies/ruby-2.7.1/bin/$(ruby\u BASE\u NAME)
--与pg
--无pg
--启用windows交叉
--禁用windows交叉
--使用pg配置
--没有pg配置
--带-pg_配置
--不带-pg_配置
--与pg dir
--没有pg dir
--与pg包括
--不带pg include=${pg dir}/include
--用pg-lib
--不带pg lib=${pg dir}/lib
要了解此扩展未能编译的原因,请检查mkmf.log,该日志可在此处找到:
/home///vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/pg-1.2.3/mkmf.log
extconf失败,退出代码1
Gem文件仍将安装在/home///vendor/bundle/ruby/2.7.0/gems/pg-1.2.3中以供检查。
结果记录到/home///vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/pg-1.2.3/gem_make.out
安装pg(1.2.3)时出错,捆绑程序无法继续。
确保'gem install pg-v'1.2.3'--源'https://rubygems.org/“`捆绑前成功。
在文件中:
pg
[@]$gem安装pg-v'1.2.3'--源代码'https://rubygems.org/'
取数pg-1.2.3.gem
错误:执行gem时。。。(Gem::FilePermissionError)
您没有/usr/local/rvm/gems/ruby-2.7.1目录的写入权限。
我已经运行了
sudo apt get install libpq dev
,它在本地计算机上解决了这个问题,然后我就可以运行
gem install pg-v'1.2.3'--source'https://rubygems.org/“
bundle install
,但我在ssh上没有sudo权限,所以我不知道如何解决这个问题。我尝试了
apt-get-install-libpq-dev
,但得到了
-bash:apt-get:command-not-found
。任何帮助都将不胜感激