react-native 下载的项目怎么run起来
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::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、
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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |