chemook78
chemook78

Reputation: 1198

What is the difference between react-native install vs npm install?

I am new to React Native and have seen several blog posts/tutorials use react-native install or npm install for the dependencies. What is the difference and what are the advantages/disadvantages between both methods?

Upvotes: 8

Views: 1401

Answers (2)

Isuru Bandara
Isuru Bandara

Reputation: 419

npm install

Purpose: Installs all dependencies listed in package.json.

Usage: For Node.js and React Native projects.

Command: npm install or npm install package-name

Advantages: works for any Node.js project, manages versions and dependencies effectively, Widely used.

react-native install

Purpose: Used to install and link React Native-specific dependencies.

Usage: specific to React Native projects.

Command: react-native install package-name Advantages: Simplified linking of native modules.

Upvotes: 0

Tobias Lins
Tobias Lins

Reputation: 2651

react-native install xxx is used to install a react native dependency which should be linked afterwards. You need to link only native iOS/Android dependencies.

The same thing can be achieved by running npm install xxx and afterwards react-native link xxx to link the library

If you just want to install a JS only lib, you can just use npm install

Upvotes: 12

Related Questions