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:更新版本命令
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的参数;
Options:
--name <string> name of the library to generate (default: null)
--config [string] Path to the CLI configuration file
-h, --help output usage information
9:react-native bundle [options]:构建离线JavaScript bundle数据传递包;
10:react-native eject [options]:重新设置react-native-cli路径
Options:
--config [string] Path to the CLI configuration file
-h, --help output usage information
11:反应原生信息
Options:
--packages [string] Which packages from your package.json to include, in addition to the default React Native and R
eact versions. (default: react,react-native)
--config [string] Path to the CLI configuration file
-h, --help output usage information
Example usage:
Get standard version info:
react-native info
Get standard version info & specified package versions:
react-native info --packages jest,eslint,babel-polyfill
12:react-native install [options]:安装和连接本地环境
react-native install [options] <packageName>
install and link native dependencies
Options:
--config [string] Path to the CLI configuration file
-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依赖项:安装环境信息列表
Options:
--entry-file <path> Absolute path to the root JS file
--output [path] File name where to store the output, ex. /tmp/dependencies.txt
--platform [extension] The platform extension used for selecting modules
--transformer [path] Specify a custom transformer to be used
--max-workers [number] Specifies the maximum number of workers the worker-pool will spawn for transfo
his defaults to the number of the cores available on your machine.
--dev [boolean] If false, skip all dev-only code path (default: true)
--verbose Enables logging
--config [string] Path to the CLI configuration file
-h, --help output usage information
CSDN 原文:https://blog.csdn.net/niuba123456/article/details/81951702?utm_source=copy