Skip to main content

NPM VS YARN

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

CommandNPMYARN
install packagenpm install package_nameyarn add package_name
uninstall packagenpm uninstall package_nameyarn remove package_name
check versionnpm -vyarn version
update devlopment packagenpm update package_nameyarn upgrade package_name

HAPPY LEARNING ๐Ÿ™Œ

References-:

  • The above image have been taken from Image1
  • official document for npm -> NPM
  • official document for yarn -> YARN