加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ReactNative调试

发布时间:2020-12-15 04:44:19 所属栏目:百科 来源:网络整理
导读:1. 缺少模块 根目录,输入 npm install ,会自动安装所需模块. 具体会调用 package.json 内容,下载 dependencies 依赖模块. { " name ": "ChunyuYuEr" ," version ": "0.0.1" ," private ": true ," scripts ": { " start ": "react-native start" } ," depend

1. 缺少模块

根目录,输入npm install,会自动安装所需模块.
具体会调用package.json内容,下载dependencies依赖模块.

{
  "name": "ChunyuYuEr","version": "0.0.1","private": true,"scripts": { "start": "react-native start" },"dependencies": { "react-native": "^0.14.2","react-native-communications": "0.0.6" } }

2. 调试

Ctrl+Command+Z启动调试页Debug in Chrome,会Chrome进行调试. 使用Command+Alt+J,可以在控制台看到调试信息.

3. Android运行

启动服务: npm start
启动程序: ./gradlew android:app:installDebug

4. 新建项目

npm install -g react-native-cli
react-native init [AwesomeProject]

5. 启动服务

首先需要保证项目中含有node_modules,默认项目中都会增加,或是使用

npm install

找到之后,在./node_modules/react-native中,使用

./packager/packager.sh

通过shell脚本,启动服务.

6. 配置数据源

初始化项目(react-native init [xxx])较慢,可以通过更新数据源的方式提速.

npm config set registry=http://registry.npm.taobao.org/

配置地址.npmrc.

registry=http://registry.npm.taobao.org/

遇到其他小技巧,我会继续更新.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读