Skip to main content

Command Palette

Search for a command to run...

⚙ Difference between NPM and Yarn

Updated
1 min read
⚙ Difference between NPM and Yarn
L

French software engineer building a new life in Japan. My journey here is a big challenge—from learning the language to navigating the tech scene. I use this blog as a space to share what I'm learning, both in tech and in life.

About NPM and Yarn

NPM and Yarn are package managers that help to manage a project’s dependencies.

NPM

  • It is a package manager for the JavaScript programming language.
  • It is the default package manager for the JavaScript runtime environment Node.js

Yarn

  • It was developed by Facebook
  • It is open-source

The intention behind developing yarn(at that time) was to fix performance and security concerns with npm.

Installation

  • npm: npm is installed with Node automatically.
  • yarn: To install yarn npm have to be installed.

      npm install yarn --global
    

The lock file

  • NPM generates a ‘package-lock.json’ file.
  • Yarn generates a ‘yarn.lock’ file.

Installing global dependencies

  • npm: To install a global package, the command template for npm is:

      npm install -g package_name@version_number
    
  • yarn: To install a global package, the command template for yarn is:

      yarn global add package_name@version_number
    

Pros and cons

Npm

  • Come with node
  • big community

Yarn

  • fast
  • offline mode
  • yarn why (to track dependences)

Sources link

https://www.geeksforgeeks.org/difference-between-npm-and-yarn/

https://blog.zenika.com/2017/03/13/npm-vs-yarn/

⚙ Technical

Part 19 of 20

In this series, I gather data on IT concepts and I come back step by step on how I made a project, introduction to a new language/framework, how to deploy on a specific platform, how to use a library.

Up next

⚙ How to use Github corner

What is it Github corner is an npm package that allows you to include in your main website page a Github logo in a corner with a custom link and a nice animation on hover. Why I use it The first time I saw something similar was on a react-Pokedex I f...

More from this blog

L

LPM Blog

194 posts

日本でのキャリアを切り拓く私の挑戦の記録です。

ここでは、私の就職活動の道のり、技術的な学び、そして異文化で働くことの喜びと苦労を共有していきます。

この挑戦を通じて、ITエンジニアとしての成長を皆さんにお見せできれば幸いです。