How to solve the git permission denied problem with expo init on MacOS?

放肆的年华 提交于 2020-01-06 08:03:38

问题


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.

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?


回答1:


To solve this problem I did 2 things.

  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.



来源:https://stackoverflow.com/questions/54604946/how-to-solve-the-git-permission-denied-problem-with-expo-init-on-macos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!