Javascript - Yarn


Yarn is a package manager

It aims to resolve two problems:

  • to download the library only once by having a local repository
  • to fix the code of the dependency. Library authors may have change the code without changing the version and break your code. The immutability of installed packages is handled via a yarn.lock file, which ensures that every install results in the exact same file structure in the node_modules across all machines.

Yarn command

Most yarn commands are similar to npm equivalents and it is fine to use the npm versions instead


for instance

  • Install a package into the current project
yarn add uglify-js
  • Install a cli globally has been deprecated for Yarn dlx to run a one off script (to install globally use npm install -g)
## deprecated
yarn add global uglify-js

Global Package

Since Node version 16, the package manager is managed by Node and the binary is in the Node HOME.

The old directory location were:

  • Linux: HOME/.config/yarn/global/
  • Windows: AppData\Local\Yarn\Data\global\package.json



error Package “xxx” refers to a non-existing file '“yyyy”'.

Go to the global package.json file and

  • modify the path
  • or delete the package from the file

Discover More
Javascript - Toolchain (Build tools)

This page is building/shipping in the context of Javascript A JavaScript build toolchain typically consists of: A package manager to install and update package such as yarn, npm. A bundler (such...
Javascript Package - Package Manager

This article talks package manager in Javascript. They are the first component of the web toolchain as they permit to: declare package as dependency download and update package create a package...
WebPack - Installation

Webpack is just a global npm package. With or Local to the project Global Cli
What are npm scripts and how to use them ? The script property of Package.json

The scripts property in package.json are command lines that: * run in the same shell than your javascript package manager (npm, yarn, etc...) * search the command executable first in the local node...

Share this page:
Follow us:
Task Runner