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 globally

yarn global add uglify-js

Global Package

Directory location:

  • 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

Powered by ComboStrap