我有两个不同的ReactNative项目:
在新项目中,react-native的cli工具包含命令"run-ios"接下来的两个"run-android",但不包括2016年januar的旧项目.在较旧的项目中没有"run-ios"命令可供选择:
$ react-native run-ios
Command `run-ios` unrecognized
Usage: react-native <command>
Run Code Online (Sandbox Code Playgroud)
我已经运行了"react-native upgrade"而没有任何问题.
如何在旧项目中获得命令"run-ios"?
当我尝试使用npm install安装redux到我的react-native项目时遇到问题.任何时候我跑npm install redux --save的react-native目录里面node_modules将被清除.
然后我使用rm -rf node_modules && npm install所有react-native包里面没有安装node_modules所以我必须重新创建项目.
我还尝试复制和过去react-redux并redux在node_modules从其他项目我目前的react-native项目.但它不能成功,错误导致我在github 上的问题.我听了这个帮助,也失败了.
其他一些信息:
➜npm:5.0.3
➜itese-native-cli:2.0.1
➜反应原生:0.45.0
➜package.json
{
"name": "MyProjectNAME",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.45.0",
"react-redux": "^5.0.5",
"redux": "^3.6.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-jest": "20.0.3",
"babel-preset-es2015": …Run Code Online (Sandbox Code Playgroud) 当尝试在我的模拟器上运行本机反应时,我收到此错误,react-native run-android
错误无法识别的命令“run-android”。
我的模拟器已连接并正在运行,有什么想法吗?
包.json:
{
"name": "iaapp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"name": "Inovative Anatomy",
"flow": "flow",
"test": "node ./node_modules/jest/bin/jest.js --watchAll"
},
"dependencies": {
"@babel/plugin-proposal-decorators": "^7.4.4",
"@react-native-community/async-storage": "^1.6.1",
"react": "16.8.5",
"react-dom": "^16.8.6",
"react-native": "0.59.10",
"react-native-circular-progress": "^1.1.0",
"react-native-component-fade": "^1.0.2",
"react-native-elements": "^1.1.0",
"react-native-fade": "^1.0.3",
"react-native-fade-in-view": "^1.0.5",
"react-native-gesture-handler": "^1.3.0",
"react-native-responsive-image": "^2.3.1",
"react-native-share": "^1.2.1",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^9.5.1",
"react-native-vector-icons": "^6.6.0",
"react-native-view-shot": "^2.6.0",
"react-native-webview": "^5.12.1",
"react-native-webview-bridge": "^0.40.1",
"react-navigation": "^3.0.9",
"react-navigation-backhandler": "^1.3.2",
"react-navigation-transitions": "^1.0.11", …Run Code Online (Sandbox Code Playgroud)