Search code examples
react-nativereact-native-cli

What is react-native-cli and @react-native-community/cli?


I am confusing about react-native-cli and @react-native-community/cli. Right now, I am using react-native-cli to generate new project.

Then I want to try react native using typescript. In the documentation, they said to "Remove react native cli" and install @react-native-community/cli.

After doing that, I can generate my react native project using typescript. But now, I cant run my old react native project, because I remove the react-native-cli.

What should I do?


Solution

  • First, remove react-native-cli

    npm uninstall -g react-native-cli
    

    Second, install @react-native-community/cli

    npm i -g @react-native-community/cli
    

    Third, with this I should able to create react native project using typescript tempalate

    npx react-native init MyApp --template react-native-template-typescript
    

    Fourth, for run existing project or old react native project

    npx react-native start
    npx react-native run-android / npx react-native run-ios
    

    Source https://github.com/react-native-community/react-native-template-typescript/issues/72