react-native 下载的项目怎么run起来

本文档介绍了在React-Native项目中遇到的常见问题及其解决方案,包括废弃警告、依赖安装错误、版本不匹配和编译错误。通过检查版本、降级到稳定版本、更新项目并添加编译选项,成功解决了一系列问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.第一步 (如果出错权限问题,sudo + npm(下面命令行))
npm install -g  React -native-cli (安装全局的好了之后react-native upgrade这个命令可以运行) 命令行工具
 2.安装 

npm install 

建议:慢的时候用下面的

npm install -g --registry=https://registry.npm.taobao.org

3.更新

react-native upgrade (然后要替换的时候输入y,不需要替换的则输入n)

4.启动 

React-native start 

5.运行(新开一个终端运行 测试 下) 

npm test 

如果安装过程发现有不对劲的地方,建议步骤:

假如npm最高是5.0版本,react-native最高是0.44版本

1、npm -v和 react-native -v 查看版本,如果不出现版本,就说明相应的npm和react-native没有安装好.

2、安装比最高版本低一个大版本最好,因为最新的版本可能各种问题,react-native目前还没有出大版本,所以不稳定因素太多,如下:

npm uninstall  npm@5.0.0      npm uninstall react-native@0.44.0 卸载高版本

npm install npm@4.0.0       npm install --save react-native@0.34.0 安装低一个大版本

如果react-native upgrade不能跑起来,就使用npm install -g react-native-cli

出现的问题:

1、deprecated node-uuid@1.4.7: use uuid module instead”

npm uninstall --save node-uuid
npm install --save uuid

2、react-native@0.34.0 requires a peer of react@~15.3.1 but none was installed.

npm install --save react@~15.3.1

3、npmWARNdeprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

npm install --save minimatch@3.0.2

4、Undefined symbols for architecture x86_64:

  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:

      _main in main.o

  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:

      _main in main.o

  "std::terminate()", referenced from:

      ___clang_call_terminate in main.o

  "___cxa_begin_catch", referenced from:

      ___clang_call_terminate in main.o

  "___gxx_personality_v0", referenced from:

      _main in main.o

      Dwarf Exception Unwind Info (__eh_frame) in main.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [main] Error 1


想了很多办法,终于看到有人提示:编译选项添加-lstdc++,即使用标准C++库,问题解决!

5、

                     

 解决办法:找到相应的App.js只能对外导出一个组件,也就是App.js 中组件export了两次
6、
             
问题原因:找不到组件
解决办法:有yarn
watchman watch-del-all
rm -rf ./node_modules
npm cache clean
yarn cache clean
rm -rf $TMPDIR/react-*
yarn install
npm cache clean
yarn cache clean
yarn add uuid
没有yarn:
watchman watch-del-all
rm -rf ./node_modules
npm cache clean
rm -rf $TMPDIR/react-*
npm install
npm cache clean
npm install uuid

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值