【问题标题】:Bundle Install Fails (Permission denied @ rb_sysopen)捆绑安装失败(权限被拒绝@rb_sysopen)
【发布时间】:2017-01-04 20:06:10
【问题描述】:

我正在尝试运行 bundle install 命令并收到此错误。我尝试了各种解决方案,例如更改读/写权限,甚至卸载并重新安装了 bundler。

我知道这里有一个类似的问题 (link),但在他的示例中,bundler 实际上是在死前获取了一些东西并开始检查宝石。就我而言,它一开始就消失了。

任何见解将不胜感激!

[wbrugato@wblaptop labels]$ bundle install

Error details

Errno::EACCES: Permission denied @ rb_sysopen - /home/wbrugato/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions
  /usr/share/ruby/fileutils.rb:1393:in `initialize'
  /usr/share/ruby/fileutils.rb:1393:in `open'
  /usr/share/ruby/fileutils.rb:1393:in `block in copy_file'
  /usr/share/ruby/fileutils.rb:1392:in `open'
  /usr/share/ruby/fileutils.rb:1392:in `copy_file'
  /usr/share/ruby/fileutils.rb:1360:in `copy'
  /usr/share/ruby/fileutils.rb:472:in `block in copy_entry'
  /usr/share/ruby/fileutils.rb:1498:in `wrap_traverse'
  /usr/share/ruby/fileutils.rb:469:in `copy_entry'
  /usr/share/ruby/fileutils.rb:530:in `rescue in block in mv'
  /usr/share/ruby/fileutils.rb:527:in `block in mv'
  /usr/share/ruby/fileutils.rb:1571:in `block in fu_each_src_dest'
  /usr/share/ruby/fileutils.rb:1587:in `fu_each_src_dest0'
  /usr/share/ruby/fileutils.rb:1569:in `fu_each_src_dest'
  /usr/share/ruby/fileutils.rb:517:in `mv'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:55:in `block in update'
  /usr/share/ruby/tmpdir.rb:89:in `mktmpdir'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:29:in `update'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:65:in `update'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:56:in `update_and_parse_checksums!'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/fetcher/compact_index.rb:67:in `available?'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/fetcher/compact_index.rb:15:in `call'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/fetcher/compact_index.rb:15:in `block in compact_index_request'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/fetcher.rb:157:in `use_api'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:332:in `block in api_fetchers'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:332:in `select'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:332:in `api_fetchers'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:337:in `block in remote_specs'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/index.rb:10:in `build'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:336:in `remote_specs'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:83:in `specs'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/lazy_specification.rb:61:in `__materialize__'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/spec_set.rb:91:in `block in materialize'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/spec_set.rb:88:in `map!'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/spec_set.rb:88:in `materialize'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:174:in `specs'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:162:in `resolve_remotely!'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/installer.rb:225:in `resolve_if_need'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/installer.rb:78:in `run'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/installer.rb:24:in `install'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/install.rb:71:in `run'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:189:in `install'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
  /home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>'
  ./bin/bundle:3:in `load'
  ./bin/bundle:3:in `<main>'

Environment

  Bundler   1.13.7
  Rubygems  2.6.8
  Ruby      2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
  GEM_HOME  /home/wbrugato/.gem/ruby/2.3.0
  GEM_PATH      /home/wbrugato/.gem/ruby/2.3.0:/usr/share/gems:/usr/local/share/gems
  Git       2.9.3

  Bundler settings

  gemfile
Set via BUNDLE_GEMFILE: "/home/wbrugato/RubymineProjects/labels/Gemfile"

【问题讨论】:

    标签: ruby-on-rails bundler


    【解决方案1】:

    我遇到了类似的问题。清除捆绑程序的缓存对我有用。

    rm -rf ~/.bundle/cache
    

    【讨论】:

    • 啊!有用。为什么缓存会导致这种情况?
    • 捆绑安装可能以不同的用户(可能是根用户)运行并拥有他们拥有的文件。看着缓存死了,权限就会显示出来。
    • @Doon,谢谢。那讲得通。我可能在某个时候跑过sudo bundle install。我想这就是为什么 bundler 警告不要这样做的原因......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-20
    • 1970-01-01
    • 2018-09-10
    • 2019-02-13
    • 1970-01-01
    • 2011-07-22
    相关资源
    最近更新 更多