ruby-on-rails - Ruby on Rails 'pg' gem 安装错误 Windows 10
问题描述
有谁知道为什么错误
“错误:执行 gem 时 ... (Errno::EACCES)
权限被拒绝@ rb_sysopen - C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/pg-1.2.3-x64-mingw32/lib/2.7/pg_ext.so"
尝试在 Windows 10 中安装 pg gem 时出现?
我尝试在我的应用程序文件夹的命令提示符下以管理员权限运行 gem install pg,但它会引发此错误。我还检查了站点https://rubygems.org/gems/pg并复制了如何通过命令行安装 pg ,以及包含在 Gemfile 中的内容。
这是我的宝石文件:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# ruby '2.5.7'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
# Use postgresql as the database for Active Record
gem 'pg', '~> 1.2', '>= 1.2.3'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
gem 'turbolinks'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'coffee-script-source'
gem 'execjs'
gem 'jquery-rails'
gem 'jbuilder'
gem 'bootstrap-sass', '~> 3.4.1'
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-attack'
gem 'rack-cors'
gem 'jwt'
# gem 'acts_as_paranoid', '~> 0.6.0'
gem 'active_model_serializers'
gem 'pagy'
gem 'pager_api'
gem "pundit"
gem "administrate", git: "https://github.com/thoughtbot/administrate"
gem "figaro"
gem 'faker'
gem 'carrierwave'
gem 'fog-aws'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
gem "pry"
end
group :development do
gem 'tzinfo-data'
gem 'annotate'
gem 'listen'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "auth0", "~> 5.0"
非常感谢您阅读本文。(ps 我是 ruby on rails 的新手,到目前为止我做了 2 个我没有使用过 pg gem 的应用程序,其他 gem 的安装都很顺利:/)
解决方案
我假设你已经在你的系统上下载并安装了 PostgreSQL。使用以下命令将 gem 指向 postgres 的安装位置。这是它在我的系统上的外观示例。
gem install pg -- --with-pg-config='C:\Program Files\PostgreSQL\13\bin\pg_config.exe'
推荐阅读
- angular - 如何使用 cypress 在 Angular 应用程序中拖放元素?
- sql - 关于 SQL 查询的建议(我的似乎过于复杂,甚至会吐出标量子查询错误)
- spacy - 关于 ner/spacy 与 pdf/docx 文件及其文本位置的一般问题
- php - 表单:不发送输入 - 提交不起作用(html/php)
- python - Sqlalchemy 子查询标量
- ms-access - 您可以创建一个访问按钮来搜索表单上的多个字段吗?
- php - 商标和版权在wordpress数据库中更改为unicodes
- python - 在熊猫中选择低于某个值的行和相应列的最佳方法
- haproxy - HAProxy - 浏览器和 Curl 报告不一致的结果
- redis - 在 Windows 10 上创建 Redis 服务