React Native: Command `run-ios` unrecognized

前端 未结 14 2074
野性不改
野性不改 2020-12-23 16:01

I have two different ReactNative-Projects:

  • a) a project from januar 2016
  • b) a complete new react-native project from now (march 20th 2016)
相关标签:
14条回答
  • 2020-12-23 16:40

    This may sound silly, but make sure you cd to your project directory. If that fails then perform the npm install in the other answers.

    0 讨论(0)
  • 2020-12-23 16:43

    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.

    0 讨论(0)
  • What caused this for me was running npm install --save [package] when actually the system has previously been using yarn instead of npm.

    To solve this I just deleted the node_modules folder and ran: yarn install and after that react-native run-ios (or android) works fine.

    0 讨论(0)
  • 2020-12-23 16:47

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

    0 讨论(0)
  • 2020-12-23 16:48

    Just update the version of react native in your project with the following command:

    $> npm install --save react-native@latest
    
    0 讨论(0)
  • 2020-12-23 16:48

    I found a solution that works for me. Update the version of react native in your project:

    npm install --save react-native@latest 
    

    then upgrade your npm version

    npm i npm@latest -g
    

    then move directory folder 1 level up, type

    cd ..
    

    make a new react-native installation folder

    react-native init NewProject
    

    then go to your project folder(NewProject), after that

    react-native run-ios
    

    should work fine.

    0 讨论(0)
提交回复
热议问题