繁体   English   中英

Ruby on Rails 'pg' gem 安装错误 Windows 10

[英]Ruby on Rails 'pg' gem installation error 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 在 Rails 上很新,到目前为止我做了 2 个我没有使用过 pg gem 的应用程序,其他 gem 的安装都很顺利:/)

我假设您已经在系统上下载并安装了 PostgreSQL。 使用以下命令将 gem 指向 postgres 的安装位置。 这是它在我的系统上的外观示例。

gem install pg -- --with-pg-config='C:\Program Files\PostgreSQL\13\bin\pg_config.exe'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM