Ruby-on-rails Errno::EACCESS: 权限被拒绝@dir_s_mkdir

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30147510/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 00:14:10  来源:igfitidea点击:

Errno::EACCESS: Permission denied @ dir_s_mkdir

ruby-on-railsruby

提问by Dekard

I am pretty new to Ruby.. was following the instructions on TeamTreehouse installing Ruby Development Environment on OSX (Yosemite).

我对 Ruby 还很陌生。按照 TeamTreehouse 在 OSX (Yosemite) 上安装 Ruby 开发环境的说明进行操作。

When I got to the step to create my test app. It's failing at the end. With Permission Denied. :( Not sure what I am doing wrong, I did try running gem install debug inspector and the bundle exec spring binstubb all and they both fail.

当我到达创建我的测试应用程序的步骤时。最后失败了。许可被拒绝。:( 不知道我做错了什么,我确实尝试运行 gem install debug inspector 和 bundle exec spring binstubb all ,但它们都失败了。

[]rails new testapp
      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/views/layouts/application.html.erb
      create  app/assets/images/.keep
      create  app/mailers/.keep
      create  app/models/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
         run  bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Installing minitest 5.6.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.2
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.1
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.5
Using activejob 4.2.1
Using mime-types 2.5
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.0
Using activerecord 4.2.1

Errno::EACCES: Permission denied @ dir_s_mkdir - /Users/jeremy/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/debug_inspector-0.0.2
An error occurred while installing debug_inspector (0.0.2), and Bundler cannot continue.
Make sure that `gem install debug_inspector -v '0.0.2'` succeeds before bundling.
         run  bundle exec spring binstub --all
rbenv: spring: command not found

The `spring' command exists in these Ruby versions:
  2.2.2

回答by hd1

Try sudo chown -R jeremy $HOME/.rbenv-- it looks like you have a permissions issue. In the future, only run rbenv as yourself, e.g. no sudo.

试试sudo chown -R jeremy $HOME/.rbenv——您似乎遇到了权限问题。将来,只能以自己的身份运行 rbenv,例如没有 sudo。

回答by Mohamed Gaber

refer to this github issue, https://github.com/bundler/bundler/issues/4590, you might need to remove the ~/.bundle sudo mv ~/.bundle /tmpthen try to create the application again

参考这个 github 问题,https://github.com/bundler/bundler/issues/4590,您可能需要删除 ~/.bundlesudo mv ~/.bundle /tmp然后再次尝试创建应用程序

回答by Gabriel

I was having a similar issue. I couldn't even get the rails newto run. In that case you should use $ ~/ chmod -R 0755 tpmto give the permission necessary to create a file in the folder, which worked fine for me.

我遇到了类似的问题。我什rails new至无法运行。在这种情况下,您应该使用$ ~/ chmod -R 0755 tpm授予在文件夹中创建文件所需的权限,这对我来说效果很好。

I found this solution on a comment over hereby @Abhi. I'm putting here because gives more visibility, since the original comment could pass unnotice by its size (which happened to me) and this question popped more to me when I was researching.

@Abhi的评论中找到了这个解决方案。我放在这里是因为提供了更多的可见性,因为原始评论可能会因其大小而被忽视(这发生在我身上)并且在我进行研究时这个问题更多地出现在我身上。