yarn examples, explained
$ yarn add -D typescript
- yarnan alternative Node.js package manager
- addadd a dependency to the project
- -Dadd to devDependencies
- typescriptan argument passed to the command
$ yarn install --frozen-lockfile
- yarnan alternative Node.js package manager
- installinstall project dependencies
- --frozen-lockfilefail rather than update the lockfile (Yarn 1)
yarn subcommands
install — install project dependenciesadd — add a dependency to the projectremove — remove a dependencyrun — run a script defined in package.jsonbuild — run the build scripttest — run the test scriptupgrade — upgrade dependencies to their latest allowed versionsdlx — download and run a package one-off (Yarn Berry)why — explain why a package is installed
yarn flags & options
| -D | add to devDependencies |
| --dev | add to devDependencies |
| --frozen-lockfile | fail rather than update the lockfile (Yarn 1) |
| --immutable | fail if the lockfile would change (Yarn Berry) |
| --production | skip devDependencies |
| --global | operate on the global package set |
Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.