安装 RVM RUBY 和 SHOPIFY-CLI 后权限被拒绝 @ dir_s_mkdir (Errno::EACCES)

Permission denied @ dir_s_mkdir (Errno::EACCES) after installing RVM RUBY AND SHOPIFY-CLI

我今天被困了这5个小时,网上似乎没有我的问题的答案....

我刚刚安装了 .rvm 和 ruby + gem 以便开始成为 Shopify 开发人员。作为安装的 shopify-cli,并因此记录 shopify version,我得到这个:

roger.rangel@Rogers-MacBook-Pro 当前 % shopify 版本 /Users/roger.rangel/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/fileutils.rb:253:in mkdir': Permission denied @ dir_s_mkdir - /Users/roger.rangel/.config/shopify (Errno::EACCES) from /Users/roger.rangel/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/fileutils.rb:253:in fu_mkdir' 来自 /Users/roger.rangel/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/fileutils.rb:231:in block (2 levels) in mkdir_p' from /Users/roger.rangel/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/fileutils.rb:229:in reverse_each' 来自 /Users/roger.rangel/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/fileutils.rb:229:in block in mkdir_p' from /Users/roger.rangel/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/fileutils.rb:211:in each' 来自 /Users/roger.rangel/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/fileutils.rb:211:in mkdir_p' from /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/config.rb:128:in write_config' 来自 /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/config.rb:55:in set' from /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/lib/shopify-cli/context.rb:607:in update_time_of_last_check' 来自 /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/lib/shopify-cli/context.rb:560:in new_version' from /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/lib/shopify-cli/core/entry_point.rb:13:in call' 来自 /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/bin/shopify:33:in block in <main>' from /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:75:in handle_abort' 来自 /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:21:in call' from /Users/roger.rangel/.rvm/gems/ruby-3.0.2/gems/shopify-cli-2.3.0/bin/shopify:32:in '

我怎样才能摆脱这个问题????我是网络开发的新手:(

当您以 root 身份使用 运行 某些安装命令时,有时会发生这种情况。也就是说,例如,如果您使用 sudo 为某些命令安装了 rvm - 这已将目录的所有权赋予计算机的 root 用户(请记住,MacOS 本质上是 UNIX UI).

要解决它,您必须在您的终端中 运行

sudo chown -R roger.rangel: /Users/roger.rangel/.config

另一种可能是您没有该目录,在这种情况下,您的终端中也没有该目录

mkdir /Users/roger.rangel/.config