react-native相关命令集

伊富
2023-12-01

1. npm

1. npm info react-native:查看react-native所有版本信息;

2. npm uninstall react-native:卸载react-native;

3. npm install --save react-native@0.55.4:安装指定版本react-native;

4. npm install:安装最新版react-native

5. npm update -g react-native-cli:更新版本命令 

2反应原生

1. react-native -h:查看react-native所有命令;

2. react-native -V:查看react-native版本号;

3. react-native --version:查看react-natie-cli版本号;

4. react-native init projectName:创建项目

5 react-native init projectName --version 0.55.4:创建指定版本的react-native项目;

6. react-native start:开启Metro Bundler(web服务器)服务

7. react-native run-ios / run-android:构建App并运行到iOS或Android模拟器;

8. react-native new-library [options]:生成一个native-library桥

react-native new-library -h:查看new-library的参数;

 
  1. Options:

  2.  
  3.   --name <string>    name of the library to generate (default: null)

  4.   --config [string]  Path to the CLI configuration file

  5.   -h, --help         output usage information

9:react-native bundle [options]:构建离线JavaScript bundle数据传递包;

 

10:react-native eject [options]:重新设置react-native-cli路径

 
  1. Options:

  2.  
  3. --config [string] Path to the CLI configuration file

  4. -h, --help output usage information

11:反应原生信息 

 
  1.  
  2. Options:

  3.  
  4. --packages [string] Which packages from your package.json to include, in addition to the default React Native and R

  5. eact versions. (default: react,react-native)

  6. --config [string] Path to the CLI configuration file

  7. -h, --help output usage information

  8.  
  9. Example usage:

  10.  
  11. Get standard version info:

  12. react-native info

  13.  
  14. Get standard version info & specified package versions:

  15. react-native info --packages jest,eslint,babel-polyfill

12:react-native install [options]:安装和连接本地环境

 
  1. react-native install [options] <packageName>

  2. install and link native dependencies

  3.  
  4. Options:

  5.  
  6. --config [string] Path to the CLI configuration file

  7. -h, --help output usage information

13:react-native uninstall [options]:卸载和不连接本地环境

14:react-native upgrade [options]:升级项目模版文件

15:react-native log-android / log-ios [options]:启动Android / iOS日志输出

16:react-native依赖项:安装环境信息列表
   

 
  1. Options:

  2.  
  3. --entry-file <path> Absolute path to the root JS file

  4. --output [path] File name where to store the output, ex. /tmp/dependencies.txt

  5. --platform [extension] The platform extension used for selecting modules

  6. --transformer [path] Specify a custom transformer to be used

  7. --max-workers [number] Specifies the maximum number of workers the worker-pool will spawn for transfo

  8. his defaults to the number of the cores available on your machine.

  9. --dev [boolean] If false, skip all dev-only code path (default: true)

  10. --verbose Enables logging

  11. --config [string] Path to the CLI configuration file

  12. -h, --help output usage information

 

CSDN 原文:https://blog.csdn.net/niuba123456/article/details/81951702?utm_source=copy 

 类似资料: