Yarn Cheat Sheet
October 11, 2021
1 min read
Yarn is a cli-based package manager developed by Facebook. You can install it by using npm, which is kind of comical when you think about it:
npm i -g yarn
Here are a bunch of how-to scripts to handle common situations:
Install all items within the package.json or install an individual package into the npm repo.
-- installs anything in the package.json yarn install -- installs a new package yarn add antd yarn add [email protected] yarn add [email protected] -- add to devDependencies yarn add -D -- install from a github repo yarn add [email protected]:owner/repo -- install a global package yarn global add
Once it's installed, you can run the program by using:
You can run a specific command in the package.json file by using:
yarn yarn build
Find packages that are outdated. This will display a list of available updates with the option of updating.
yarn upgrade-interactive yarn upgrade-interactive -- latest
List all of the installed packages…this is the same as just looking in the package.json file
Other Helpful Commands
-- clear out the cache yarn cache clean -- removes unneeded files yarn autoclean -- uninstalls a package yarn remove