UFO ET IT

React Native :`run-ios` 명령이 인식되지 않습니다.

ufoet 2021. 1. 9. 10:37
반응형

React Native :`run-ios` 명령이 인식되지 않습니다.


두 가지 ReactNative-Projects가 있습니다.

  • a) 2016 년 1 월 프로젝트
  • b) 지금부터 완전히 새로운 반응 네이티브 프로젝트 (2016 년 3 월 20 일)

새 프로젝트 내에서 react-native의 cli 도구는 "run-ios"다음 두 개의 "run-android"명령을 포함하지만 2016 년 1 월의 이전 프로젝트에는 없습니다. 이전 프로젝트에는 "run-ios"명령이 없습니다. 유효한:

$ react-native run-ios
Command `run-ios` unrecognized
Usage: react-native <command>

나는 이미 아무런 문제없이 "반응 네이티브 업그레이드"를 실행했습니다.

이전 프로젝트에서도 "run-ios"명령을받을 수 있습니까?


다음 명령을 사용하여 프로젝트에서 React Native 버전을 업데이트하십시오.

$> npm install --save react-native@latest

이 문제의 원인은 npm install --save [package]실제로 시스템이 이전 yarnnpm.

이 문제를 해결하기 위해 방금 node_modules폴더를 삭제 하고 실행했습니다. yarn install그 후 react-native run-ios(또는 Android)가 정상적으로 작동합니다.


 $ react-native run-ios

이 오류가 발생하는 경우 :

" run-ios인식 할 수없는 명령 입니다. 실행 npm install했고 반응 네이티브 프로젝트 내에 있는지 확인하십시오 ."

터미널에서 반응 네이티브 프로젝트 디렉토리 안에 있는지 확인하십시오.

이 cmd를 실행하십시오.

$ react-native -v
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
$ npm update
$ react-native -v
react-native-cli: 2.0.1
react-native: 0.44.0
$ react-native run-ios

이것은 어리석게 들릴 수 있지만 프로젝트 디렉토리로 이동하십시오. 실패하면 다른 답변에서 npm 설치를 수행하십시오.


저에게 맞는 솔루션을 찾았습니다. 프로젝트에서 React Native 버전을 업데이트합니다.

npm install --save react-native@latest 

그런 다음 npm 버전을 업그레이드하십시오.

npm i npm@latest -g

그런 다음 디렉토리 폴더를 한 수준 위로 이동하고

cd ..

새로운 반응 네이티브 설치 폴더 만들기

react-native init NewProject

그런 다음 프로젝트 폴더 (NewProject)로 이동하십시오.

react-native run-ios

잘 작동합니다.


This happens when the project has an older version of react native. You can update the react version or for people who do not want to upgrade, just open the .xcodeproj file in iOS dir and hit the play button in the Xcode.


I created a brand new react-native project using
$ react-native init projectName
and ran from root of the project
$ react-native run-ios
Everything worked fine and iOS simulator fired up as expected.

Than I installed prop-types node module using npm install prop-types --save. Re-ran $ react-native run-ios and ran into this error Command run-ios unrecognized

Solution: From the root of my project, removed node_module and re-installed modules using npm. Commands below

$ rm -rf node_modules/
$ npm install
$ react-native run-ios

For me, Xcode was already running.

Close the Xcode and then in the terminal, make sure you are inside a react-native project directory and then execute react-native run-ios command


For me, the only thing that worked was to checkout again my repository from zero and run:

npm install -g react-native-cli yarn 
yarn  
git submodule update --init --recursive

What caused this for me was running npm install --save axios when actually the system was previously using yarn instead of npm.

To solve this, instead of deleting the node_modules folder, which can lead to more problems, and if you prefer to run npm anyway or don't have a preference either way, the error should have instructed for you to run npm install. If you literally follow those instructions, you will be able to run: react-native run-ios afterwards.


I also fell in this error and the reason was
I was using yarn link command in wrong folder

ReferenceURL : https://stackoverflow.com/questions/36119358/react-native-command-run-ios-unrecognized

반응형