Home > Enterprise >  Run React Native project with yarn without installing global packages?
Run React Native project with yarn without installing global packages?

Time:04-18

I usually run React Native projects with npx react-native start -> npx react-native run-ios. I'm collaborating on a project that uses yarn instead of npm. If I run yarn to install the project's packages, is there a way to then run the project using yarn instead of npx, and without having to install the global react-native package?

CodePudding user response:

You should be fine with running the following:

npm install -g yarn
yarn global add react-native-cli
react-native init sample

CodePudding user response:

If the project was setup using npx react-native init ..., you should have default commands in package.json to execute the app.

e.g. "ios": "react-native run-ios"

Therefore you could use yarn ios (or) yarn android to fire up the app.

P.S. Not entirely sure if you can run it without having the react-native cli installed globally on your machine.

  • Related