About
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
See: https://yarnpkg.com/en/docs/usage
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
Configuration
Support
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