React Native: Command `run-ios` unrecognized

前端 未结 14 2072
野性不改
野性不改 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:25

    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.

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

    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
    
    0 讨论(0)
  • 2020-12-23 16:27

    In my case, it was an issue with the package.json file. I deleted a section during a test. I recover a previous file with the deleted section and everything was working again.

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

    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
    
    0 讨论(0)
  • 2020-12-23 16:32

    Delete the node-modules. Its because the packages are not installed.

    rm -rf node_modules npm install

    then run your project

    react-native run-ios

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

    this works for me

    sudo npm install -g react-native-cli --force 
    

    then

    react-native run-ios
    
    0 讨论(0)
提交回复
热议问题