HelloWord --RN

1.运行rn到iOS模拟器上
react-native run-ios --simulator
2.错误:
ls: /Users/Jerry/Library/Caches/com.facebook.ReactNativeBuild/glog-0.3.5.tar.gz: No such file or directory
shasum: /Users/Jerry/Library/Caches/com.facebook.ReactNativeBuild/glog-0.3.5.tar.gz:

答案:是下载第三方库失败,修改

/Users/Jerry/Desktop/demoTests/HelloWorld/node_modules/react-native/scripts/ios-install-third-party.sh

文件中下载地方的代理,

        (cd "$cachedir"; curl -J -L -O "$url")
        fetched=yes

修改之后:

rm -f "$cachedir/$file"
        (cd "$cachedir"; curl -J -L -O -x 127.0.0.1:1087 "$url")
        fetched=yes

方可解决问题

3. “config.h” file not found react native iOS

这是下载的第三方没有编译需要执行命令

cd node_modules/react-native/third-party/glog-0.3.4/
./configure
4.
Port 8081 already in use, packager is either not running or not running correctly
Command PhaseScriptExecution failed with a nonzero exit code

设置 build System LegacyBuild System

5.8081占用

error:Connection to localhost port 8081 [tcp/sunproxyadmin] succeeded!
Port 8081 already in use, packager is either not running or not running correctly
Command /bin/sh failed with exit code 2

方案:

killall -9 node
yarn start &react-native run-ios
6.识别不了CFBundleIdenID
react-native app doesn't work ":CFBundleIdentifier", Does Not Exist 

方案:

删除node_modules 和相关的build文件夹 
执行npm install

7. 占用8081

 ERROR  Metro Bundler can't listen on port 8081

方案:

a.找到占用端口的应用

sudo lsof -i :8081//占用8081的进程
kill -9 40247 //杀死进程
react-native start //重新启动服务
8 .root-state is uid 777 and doesn't match your euid 501

方案:

rm -rf /usr/local/var/run/watchman/root-state
HelloWord

至此 Helloword已经运行完成,不过文字没有显示出来,那我们把标签的代码贴出来。

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';

const instructions = Platform.select({
  ios: '第一个程序\n',
  android: '第一个程序\n',
});

export default class App extends Component<{}> {
  render() {
    return (
      <View style={styles.container}>
      
        <Text style={styles.welcome}>
          Hello Word
        </Text>
       
        <Text style={styles.instructions}>
          {instructions}
        </Text>
      </View>
    );
  }
}
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 11,573评论 1 32
  • #画眉深浅入时无# 本想读几页书,便睡去,却看到这篇文章,心有所感,便随手记下… 在学校书店偶然遇到这...
    才華的泡麵阅读 500评论 0 2
  • 每个人所思所想那么不同,表现出的作品也完全不一样。看过很多风格,每一种都好喜欢呀!统统想要临摹一遍。生活在艺...
    木木橙子Spring阅读 321评论 1 5
  • 时间是个好东西,验证了人心,见证了人性,懂得了真的,明白了假的,没有过不去的经历,只有走不出的自己! 我总是担心身...
    新慢步者阅读 86评论 0 0
  • 一天一条饥饿的蛇在找吃的,它找了好久,却发现了一只熟睡的熊,它无法吃下它,气的它放了个大臭屁,走开了,这时蛇有看到...
    zhana689阅读 153评论 0 0

友情链接更多精彩内容