Aug*_*aug 6 ruby postgresql ruby-on-rails windows-7 bundle-install
使用 Windows 7 Ultimate 并以管理员身份运行 cmd。
我最近开始在 rails 上使用 ruby,在我的新 rails 应用程序中,我尝试安装 postgres(pg) gem,然后出现权限被拒绝错误,如下所示:
C:\wamp\www\RailsApp>bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/...........
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.8
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.8
Using rack 1.5.2
Using rack-test 0.6.3
Using actionpack 4.1.8
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.1.8
Using activemodel 4.1.8
Using arel 5.0.1.20140414130214
Using activerecord 4.1.8
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.8
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.6
Using jquery-rails 3.1.2
Errno::EACCES: Permission denied @ rb_sysopen - C:/Ruby21/lib/ruby/gems/2.1.0/ge
ms/pg-0.18.1-x86-mingw32/lib/2.1/pg_ext.so
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.
Run Code Online (Sandbox Code Playgroud)
我试过了
gem install pg
Run Code Online (Sandbox Code Playgroud)
这导致了同样的错误。
但是......当我尝试
gem install pg -mingw32
Run Code Online (Sandbox Code Playgroud)
显示成功:
C:\wamp\www\RailsApp>gem install pg -mingw32
Fetching: pg-0.18.1-x86-mingw32.gem (100%)
Successfully installed pg-0.18.1-x86-mingw32
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.18.1-x86-mingw32
Installing ri documentation for pg-0.18.1-x86-mingw32
Done installing documentation for pg after 16 seconds
1 gem installed
Run Code Online (Sandbox Code Playgroud)
尽管在搜索了几篇文章后,我未能找到如何使用 gemfile 实现此功能以使捆绑程序无错误运行的解决方案,也没有找到解决方案为什么我首先获得权限被拒绝错误。
这是我当前的 gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
Run Code Online (Sandbox Code Playgroud)
注意:我试过使用
gem 'pg', platform: :mingw
Run Code Online (Sandbox Code Playgroud)
然而,错误仍然发生。
希望这有助于使我的问题变得清晰,并随时提问,我会提供更多可能的数据。
任何建议都被重视和接受,谢谢。
小智 0
看起来bundle正在尝试将东西安装在
C:/Ruby21/lib/ruby/gems/2.1.0/ge
ms/pg-0.18.1-x86-mingw32/lib/2.1/
Run Code Online (Sandbox Code Playgroud)
目录,并且您的用户(或正在执行捆绑包的进程)不必将permission内容写入该特定目录。
我不是捆绑方面的专家,但您可以尝试的一个故障排除步骤是以管理员身份明确运行 Windows 命令提示符。您可以通过搜索CMD,然后右键单击它并选择 来执行此操作"run as administrator"。这有时可以纠正在 Windows 中安装内容时的文件权限问题。
| 归档时间: |
|
| 查看次数: |
3897 次 |
| 最近记录: |