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.
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
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”'.
- modify the path
- or delete the package from the file