如何解决如何在没有 sudo 权限的情况下安装 libpq-dev?
我通过 ssh 连接到远程服务器(我不是该服务器的管理员),我正在尝试运行 bundle install 并获取此信息:
[<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.
我已经运行了 sudo apt-get install libpq-dev
并且它在本地计算机上解决了这个问题,然后我能够运行 gem install pg -v '1.2.3' --source 'https://rubygems.org/'
和 bundle install
,但是我没有 sudo 权限ssh,所以我不知道如何解决这个问题。我尝试了 apt-get install libpq-dev
但得到了 -bash: apt-get: command not found
。任何帮助将不胜感激。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。