NPM VS YARN
npm and yarn both are popular package manager.They are used to manage project's dependencies.
NPM
- NPM stands for node package manager.
- It's package manager for javascript programming language.
- It's open source.
- Default package manager for Node.js.
YARN
- YARN stands for yet another resource negotiator.
- It's package manager for javascript programming language.
- It's developed by facebook.
- It's open source.
now let's get to know the differences between npm and yarn are explained below:
1.how to install npm and yarn
for install npm first we have to install node.js and then npm is installed automatically with node.
for install yarn npm have to installed using below coomand we can install yarn.
npm install yarn --global
2. fetching packages
npm fetches dependencies from npm registry during every 'npm install' command.
yarn stores dependencies locally, and fetches from the disk during a 'yarn add' command
3. command used for installing global dependencies using npm and yarn
-> npm install -g package_name@version_number
-> yarn global add package_name@version_number
commands for same procedures in npm and yarn
Command | NPM | YARN |
---|---|---|
install package | npm install package_name | yarn add package_name |
uninstall package | npm uninstall package_name | yarn remove package_name |
check version | npm -v | yarn version |
update devlopment package | npm update package_name | yarn upgrade package_name |