gpt4 book ai didi

ruby-on-rails - bundle 安装和访问被拒绝错误的问题

转载 作者:太空宇宙 更新时间:2023-11-03 16:23:18 24 4
gpt4 key购买 nike

我正在尝试运行从 heroku 克隆的应用。

当我运行 bundle install 时出现错误

Permission denied @ dir_s_mkdir - /Users/grant/.rvm/gems/ruby-2.2.1/gems/pg-0.18.1

我想我可能在不应该的时候使用了 sudo。

我正在使用 rvm 来设置和安装 ruby​​ 的版本。

知道我在哪里出错或尝试什么吗?

这是包安装输出

bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.6.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.5
Using activejob 4.2.1
Using mime-types 2.5
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.0
Using activerecord 4.2.1
Using annotate 2.6.8
Using bcrypt 3.1.10
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using columnize 0.9.0
Using byebug 4.0.5
Using hitimes 1.2.2
Using timers 4.0.1
Using celluloid 0.16.0
Using coderay 1.1.0
Using database_cleaner 1.3.0
Using orm_adapter 0.5.0
Using thor 0.19.1
Using railties 4.2.1
Using responders 2.1.0
Using warden 1.2.3
Using devise 3.4.1
Using devise-bootstrap-views 0.0.4
Using diff-lcs 1.2.5
Using execjs 2.5.2
Using factory_girl 4.5.0
Using jquery-rails 4.0.3
Using method_source 0.8.2

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/grant/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150501-78076-1xp3o2c.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=/Users/grant/.rvm/rubies/ruby-2.2.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

extconf failed, exit code 1

Gem files will remain installed in /var/folders/gv/nz0x58_161x73_vks6_t_0qm0000gn/T/bundler20150501-78076-7cddl5/pg-0.18.1/gems/pg-0.18.1 for inspection.
Results logged to /var/folders/gv/nz0x58_161x73_vks6_t_0qm0000gn/T/bundler20150501-78076-7cddl5/pg-0.18.1/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.1/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
~/Source/applicantlabs> gem install pg -v '0.18.1'
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ dir_s_mkdir - /Users/grant/.rvm/gems/ruby-2.2.1/gems/pg-0.18.1

----编辑

如果我然后按照建议的一个答案添加

group :production do
gem 'pg'
gem 'rails_12factor'
end

然后运行 ​​bundle install 我得到以下输出:

~/Source/applicantlabs> bundle install
Your Gemfile lists the gem pg (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem rails_12factor (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.6.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.5
Using activejob 4.2.1
Using mime-types 2.5
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.0
Using activerecord 4.2.1
Using annotate 2.6.8
Using bcrypt 3.1.10
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using columnize 0.9.0
Using byebug 4.0.5
Using hitimes 1.2.2
Using timers 4.0.1
Using celluloid 0.16.0
Using coderay 1.1.0
Using database_cleaner 1.3.0
Using orm_adapter 0.5.0
Using thor 0.19.1
Using railties 4.2.1
Using responders 2.1.0
Using warden 1.2.3
Using devise 3.4.1
Using devise-bootstrap-views 0.0.4
Using diff-lcs 1.2.5
Using execjs 2.5.2
Using factory_girl 4.5.0
Using jquery-rails 4.0.3
Using method_source 0.8.2


Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:

bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.

Password:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/grant/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150501-78195-lok4ja.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=/Users/grant/.rvm/rubies/ruby-2.2.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

extconf failed, exit code 1

Gem files will remain installed in /var/folders/gv/nz0x58_161x73_vks6_t_0qm0000gn/T/bundler20150501-78195-2sr6oh/pg-0.18.1/gems/pg-0.18.1 for inspection.
Results logged to /var/folders/gv/nz0x58_161x73_vks6_t_0qm0000gn/T/bundler20150501-78195-2sr6oh/pg-0.18.1/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.1/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.

最佳答案

在您的 Gemfile 生产部分,添加 pg 和 rails_12factor Gems

 group :production do
gem 'pg'
gem 'rails_12factor'
end

然后运行 ​​bundle install 命令,提交更改并推送到 heroku。

关于ruby-on-rails - bundle 安装和访问被拒绝错误的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29987958/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com