React Native 搭建环境问题

1、macOS安装homebrew报错 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54

// 执行下面这句命令,更换为中科院的镜像:
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

// 把homebrew-core的镜像地址也设为中科院的国内镜像

cd "$(brew --repo)" 

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" 

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

// 更新
brew update

// 使用
brew install node

2、fatal: destination path '.' already exists and is not an empty directory

// 执行下面这句命令,更换为中科院的镜像:git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1 然后报如上错误
方案:删除/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core这个目录,然后重新执行命令

3、Mac 上卸载node和npm卸载node,依次在终端执行下面的脚本

sudo npm uninstall npm -g
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d
最后验证一下

node //command not found
npm //command not found
就卸载完了。

4、brew install node
4.1、下载卡在python下载那里,从官网下载并安装
4.2、继续安装,报错The 'brew link' step did not complete successfully

image

其实这里已经给出了方法:

执行第一个命令一般不会出现问题。直接回车就行。

执行第二个命令的时候我这里出现了一些问题:
image
说我没有 /usr/local/share/doc/...这一大堆的权限。

这个权限不是我们加入sudo的权限

然后我又在Stack Overflow上面查一下 有兴趣的可以看一下: [时空车走起](https://stackoverflow.com/questions/26647412/homebrew-could-not-symlink-usr-local-bin-is-not-writable)

输入命令行:

sudo chown -R `whoami`:admin  /usr/local/share/doc/node       注意红色的地方我们可能不一样,需要换上你自己的没有权限操作的文件

5、npx react-native init AwesomeProject 报错如下提示,根据报错提示,进入AwesomeProject目录执行pod install

Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./AwesomeProject/ios && pod install".

6、pod install 报错如下提示:
6.1、更新OpenSSL:brew upgrade openssl
6.2、更新ruby:brew install rbenv ruby-build
6.3、执行:pod install --repo-update

runk Repo update failed - 38 error(s):
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/3/2/5/FlipperKit/0.11.1/FlipperKit.podspec.json Response: Couldn't connect to server

7、如果 pod install --repo-update 失败,提示如下,执行:pod repo update --verbose, 成功后再执行pod install --repo-update。

注意:pod install --repo-update需要网络好,或者稳定的翻墙网络,如果继续失败切换翻墙、不翻墙执行。多试几次就成功了

CocoaPods was not able to update the master repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose

参考文献

The 'brew link' step did not complete successfully

macOS安装homebrew报错 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54

你可能感兴趣的:(React Native 搭建环境问题)