git - 如何解决 MacOS 上 expo init 的 git 权限被拒绝问题?
问题描述
我在我的 Mac 上使用 expo init 命令遇到了这个烦人的 git 问题。
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 项目。我已经正确设置了所有内容,但是这个问题只是坐在那里,花了一些时间才弄清楚试图更改某些文件夹等的访问权限。我该如何解决这个问题?
解决方案
为了解决这个问题,我做了两件事。
- 启动一个新终端(在我的情况下为 iTerm)并
sudo su
立即执行。 - 现在使用 sudo 再次运行 expo init 命令:
sudo expo init my-proj
然后它起作用了。没有错误。希望这可以帮助某人。
推荐阅读
- django - Docker-compose 与 Django、Redis、Gunicorn、Uvicorn、Nginx:我的 Nginx 工作正常吗?
- regex - 应用程序脚本和正则表达式。如何?
- javascript - 如何在网站上禁用 facebook 自动问候消息
- php - 是否有存储控制台输出的变量?(密码接收)
- java - 尝试使用 java 中的 smtp 服务器发送邮件时出现此错误!如何解决这个问题
- excel - 表单 ComboBox 值,true=-1?
- android - android中仅使用XML的模糊背景
- javascript - 单击和滚动更改文本和图像/视频
- python - 清除以前的线图但在 Python 中保留轴限制
- iteration - 如何使用 Tcl 进入期望操作的无限循环?