RNdev
RNdev

Reputation: 1251

Run React Native project with yarn without installing global packages?

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?

Upvotes: 0

Views: 2140

Answers (2)

SFer Developer
SFer Developer

Reputation: 81

Init the project with npx react-native@latest init yourProjectName

And use yarn instead of npx when running React Native commands inside your existing project.

docs page

e.g: Instead of npx react-native start use yarn react-native start

You can read more on RN docs

Upvotes: 0

DevDonchev
DevDonchev

Reputation: 1

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.

Upvotes: 0

Related Questions