安装新gem时,权限被拒绝

时间:2018-08-29 12:59:42

标签: ruby rubygems

我在Windows 7中,我可以看到我所有的宝石都在: C:\ Users \ alotfi2.gem \ specs \ api.rubygems.org%443 \ quick \ Marshal.4.8

上周,我们收到了管理员发来的电子邮件:

迁移后,您的H:驱动器将为只读。这意味着您将能够访问和传输文件,但将无法对其进行编辑或将任何新文件保存到H:驱动器。

但是当我尝试安装新的gem时,我得到了:

宝石安装慢性 错误:执行gem时...(Errno :: EACCES)     权限被拒绝@ rb_sysopen-H:/。gem / specs / api.rubygems.org%443 / quick / Marshal.4.8 / chronic-0.10.2.gemspec

gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.3.0
  - RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x64-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby24-x64/lib/ruby/gems/2.4.0
  - RUBY EXECUTABLE: C:/Ruby24-x64/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby24-x64/bin
  - SPEC CACHE DIRECTORY: H:/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x64-mingw32
  - GEM PATHS:
     - C:/Ruby24-x64/lib/ruby/gems/2.4.0
     - H:/.gem/ruby/2.4.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - C:\majid\cmder\bin
     - C:\majid\cmder\vendor\git-for-windows\cmd
     - C:\majid\cmder\vendor\conemu-maximus5\ConEmu\Scripts
     - C:\majid\cmder\vendor\conemu-maximus5
     - C:\majid\cmder\vendor\conemu-maximus5\ConEmu
     - C:\Program Files (x86)\Shoes
     - C:\Ruby24-x64\bin
     - C:\Users\alotfi2\AppData\Local\Programs\Python\Python36-32\Scripts\
     - C:\Users\alotfi2\AppData\Local\Programs\Python\Python36-32\
     - C:\Users\alotfi2\AppData\Roaming\npm
     - C:\Program Files\Docker Toolbox
     - C:\majid\cmder\vendor\git-for-windows\usr\bin
     - C:\majid\cmder\vendor\git-for-windows\usr\share\vim\vim74
     - C:\majid\cmder\

感谢您的帮助。 谢谢。

1 个答案:

答案 0 :(得分:0)

您的SPEC CACHE DIRECTORY仍链接到H:驱动器,要更改其值,您必须按照this thread中所述设置环境变量GEM_SPEC_CACHE。
为此,在Windows上,您需要使用SetX命令。例如:

SETX GEM_SPEC_CACHE C:\Users\User\.gem\abc  

您应该具有对目录C:\ Users \ User \ .gem \ abc的写访问权,这样它才能起作用。