Technology Sharing

【IOS】React Native之HelloWorld

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

RN builds development environment
rvm installation 3.2.2

brew install node@18
brew install watchman

# 使用nrm工具切换淘宝源
npx nrm use taobao

# 如果之后需要切换回官方源可使用
npx nrm use npm

npm install -g yarn

brew install cocoapods

npm uninstall -g react-native-cli @react-native-community/cli
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
 npx react-native@latest init AwesomeProject

cd AwesomeProjectcd

# 如果没有node_modules文件夹 
npm install

cd ios

pod install
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

Because the project generated by rn always reports glog errors, you need to use the glog source code to overwrite the glog folder in the project Pods

Download glog source code to cover glog in the project

insert image description here

If it still reports Command PhaseScriptExecution failed with a nonzero exit code, check this
insert image description here
No bundle URL present
insert image description here

To run in the root index.js directory

npm start
  • 1