kojow7
kojow7

Reputation: 11414

using the npx command to run a react-native project

Previously, when I had tried using react-native we were told to use react-native run-ios to run the project from the command line. Now, the instructions say to use npx react-native run-ios from the command line.

What in the benefit of using npx. Does using npx change how the project is compiled? If I sometimes use npx and sometimes neglect to use it will it mess anything up in my project?

Upvotes: 2

Views: 2202

Answers (1)

lwinkyawmyat
lwinkyawmyat

Reputation: 1242

Check this answer more about of npx


react-native supported and recommended to use npx start from [email protected].

The benefit of using npx is don't need to install react-native-cli tools globally. Check the below example of using npx and not for the react-native project.

### Using npx ###
﹩ npx react-native init <SimpleProjectName>
### Without using npx ###
﹩ npm i -g react-native-cli
﹩ react-native init <SimpleProjectName>

Both react-native-cli and npx react-native are should not use in one project. The official docs said before starting a new project:

If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.

Upvotes: 1

Related Questions