如何在MacOS上使用expo init解决git权限被拒绝的问题? [英] How to solve the git permission denied problem with expo init on MacOS?

查看:166
本文介绍了如何在MacOS上使用expo init解决git权限被拒绝的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac上的expo init命令中遇到了这个令人讨厌的git问题.

I was having this annoying git problem with expo init command on my Mac.

MacBook-Pro:ReactNativeProjects SoftwareTheory$ sudo expo init proj2
Password:
? Choose a template: expo-template-blank
? Choose which workflow to use: managed
✔ Please enter a few initial configuration values.
  Read more: https://docs.expo.io/versions/latest/workflow/configuration · 100% completed
[11:58:15] Extracting project files...
[11:58:15] Customizing project...
[11:58:15] Unable to initialize git repo. `git` not installed.
[11:58:15] Installing dependencies...
npm ERR! code 1
npm ERR! Command failed: /usr/local/bin/git clone --depth=1 -q -b expo-font-fix git://github.com/expo/vector-icons.git /Users/SoftwareTheory/.npm/_cacache/tmp/git-clone-3c497330
npm ERR! /Users/SoftwareTheory/.npm/_cacache/tmp/git-clone-3c497330/.git: Permission denied
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/SoftwareTheory/.npm/_logs/2019-02-09T08_58_32_541Z-debug.log
[11:58:32] Process exited with non-zero code: 1
[11:58:32] Set EXPO_DEBUG=true in your env to view the stack trace.

我只是无法启动一个基本的ReactNative项目.我已经正确设置了所有内容,但是这个问题就坐在那儿,花了一些时间才弄清楚,试图更改某些文件夹等的访问权限.我该如何解决呢?

I was just not able to start a basic ReactNative project. I had setup everything correctly but this problem was just sitting there and it took sometime to figure it out trying to change the access rights for some folders etc. How can I solve this?

推荐答案

为解决此问题,我做了两件事.

To solve this problem I did 2 things.

  1. 启动一个新终端(在我的情况下为iTerm)并立即执行sudo su.
  2. 现在使用sudo再次运行expo init命令:sudo expo init my-proj
  1. Start a new terminal (iTerm in my case) and do a sudo su immediately.
  2. Now run expo init command again with sudo: sudo expo init my-proj

然后它起作用了.没有错误.希望这对某人有帮助.

Then it worked. No errors. Hope this helps someone.

这篇关于如何在MacOS上使用expo init解决git权限被拒绝的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆