맥은 + 반응 네이티브 환경을 구축하기 위해

주요 참조  https://reactnative.cn/docs/getting-started.html  반응 네이티브 중국어 네트워크

 

IOS 버전

(1) 상기 기지국 V10은 워치와 네이티브 명령 줄 도구 반응 및 엑스 코드

 

브루 도구를 설치, 그것은 첫 번째 설치가 느려질 수 있습니다 나중에 설치하기 쉽고, 인내심. . .

-e 루비 " $ (컬 -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install) " 

로 인해 느린 미러링 외국의 기본값으로 설치 후, 국내의 소스 주소를 수정해야 가.

 

1 )替换brew.git 
CD " $ (양조 --repo) " 
자식 원격 설정 -url 원점에 https : // mirrors.ustc.edu.cn/brew.git 



2 )替换homebrew- core.git 
CD " $ (BREW --repo) / 도서관 / 도청 / 사제 / 사제 코어 " 
자식 원격 설정 -url 원점에 https : // mirrors.ustc.edu.cn/homebrew-core.git

 

설치 노드

BREW 설치 설치의 지시를 따르 종속성을 따라하라는 메시지가 표시 될 수 있습니다 노드를

 

설치 경비원

양조   설치 파수꾼
또한 미러 주소 변경 

후 SET 레지스트리 HTTPS를 config (설정) NPM을 : // registry.npm.taobao.org
 
--global NPM 설정 후 SET disturl HTTPS : // npm.taobao.org/dist --global

 

도 2는,  기본 명령 줄 도구 (--CLI 반응 자국어) 반작용 , 예를 들어, 다른 도구 한국어의 NPM 제공을 NPM 실을 설치 한 후 대신 사로 사용될 수 yarn대신 npm install하여, 명령 yarn add 某第三方库名대신npm install 某第三方库名

NPM 설치 -g 원사 반응-native- CLI를
미러 주소를 수정
원사 설정 세트 레지스트리은 https : // registry.npm.taobao.org - 글로벌  원사 설정 세트 disturl은 https : // npm.taobao.org/dist --global

 

3, 기본 현재 필요 반작용 엑스 코드  버전 9.4 이상을 앱 스토어 다운로드

 

4, 초기화 프로젝트

반응 네이티브 초기화 AwesomeProject

 

5, 컴파일 및 네이티브 응용 프로그램 반작용 실행

cd AwesomeProject

react-native run-ios
注意: 此步骤可能会提示xcrun: error: unable to find utility "instruments", not a developer tool or in PATH错误,

解决方法:

1sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/ 命令即可解决此问题



可能会提示Could not find iPhone 6 simulator--

解决方法:

1、react-native run-ios --simulator="iPhone 6",运行时指定启动版本

2 、打开项目文件node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js

然后,Check if your device version is correct, e.g: in line 29 console.log(version) 。在文件30行,对比是否是这个条件:Compare it with condition in line 30: if (version.indexOf('iOS') !== 0) {

  注释掉的是version.indexOf('iOS') !== 0,然后替换成

if (version.indexOf('iOS') !== 0 && !version.includes('iOS')) {
continue;
}

 

6、 再重新执行react-native run-ios --simulator="iPhone 6" 命令,如果成功就可以看到手机模拟运行的效果了

 

 

android版

1、下载adroid studio https://developer.android.google.cn/studio/

2、按照https://reactnative.cn/docs/getting-started.html上面给出的安装步骤依次操作即可,上面说是要翻墙,但好像不翻也可以!!!

需要注意的地方是在运行项目的时候,得先新建模拟器,不然在react-native run-android执行时,

会出现installDebug FAILED,网上说修改gradle版本,还有改distributionURL参数。本人都没改,在Android studio 新建好模拟器即可!!!

 

至此,以上就是本人在Mac 10.14.6 搭建react-native的过程及其过程中所遇到的问题,给小伙伴们提供个参考吧。

추천

출처www.cnblogs.com/codechange/p/11415280.html