Yarn Command | npm Equivalent | Description |
yarn init | npm init | Initializes a new project |
yarn install | npm install | Installs dependencies based on the package.json file |
yarn add <package> | npm install <package> | Adds a package as a project dependency |
yarn remove <package> | npm uninstall <package> | Removes a package from project dependencies |
yarn upgrade | npm update | Upgrades packages to their latest versions |
yarn global add <package> | npm install -g <package> | Installs a package globally |
yarn run <script> | npm run <script> | Runs a script defined in the package.json file |
yarn build | npm run build | Builds the project according to the build script |
yarn test | npm run test | Runs tests defined in the project |
yarn start | npm start | Starts the project |
yarn publish | npm publish | Publishes the package to a registry |
yarn clean | npx rimraf node_modules | Cleans the project by removing the node_modules directory |
|
| Lists installed packages and their dependencies |
|
| Checks for outdated packages |
|
| Interactively upgrades packages to their latest versions |
|
| Adds a package as a development dependency |
|
| Removes a development dependency |
|
| Removes a globally installed package |
|
| Creates a symbolic link between a package and a project |
| - | Creates symlinks for all packages in a monorepo |
|
| Removes a symbolic link between a package and a project |
| - | Removes all symlinks created by |
|
| Clears the package cache |
|
| Logs in to a package registry |
|
| Logs out from a package registry |
|
| Sets a Yarn or npm configuration value |
|
| Gets the value of a Yarn or npm configuration key |
|
| Deletes a Yarn or npm configuration key and its value |
|
| Adds a package to a specific workspace |
|
| Removes a package from a specific workspace |
|
| Runs a script in a specific workspace |
|
| Runs a command in the context of a specific workspace |
|
| Displays information about the workspaces in a project |
|
| Runs a script in all workspaces in a project |
|
| Runs a command in each workspace in a project |
|
| Lists all the workspaces in a project |
|
| Runs a script in the context of all workspaces |
| - | Sets the current workspace context for running commands |
| - | Initializes the Yarn autoclean feature |
| - | Removes unnecessary files from the Yarn cache |
| - | Shows which files would be removed by autoclean |
| - | Generates a lockfile entry for a given package |
|
| Creates a compressed tarball of the package |
| - | Checks if installed package files have been tampered with |
| - | Forces the installation of a package to a single version |
| - | Forces installation using only the lockfile dependencies |
|
| Installs only production dependencies, excluding devDeps |
|
| Disables generation of a lockfile during installation |
|
| Skips execution of lifecycle scripts during installation |
|
| Uses the offline mirror for installation if available |
|
| Sets the network timeout for package installation |
|
| Creates a compressed tarball with a specific filename |
|
| Runs a script defined in the |
|
| Runs a custom command specified in the |
|
| Executes a command within the context of the project |
| - | Removes the generated build artifacts and temporary files |
|
| Displays the directory where Yarn or npm stores the cache |
|
| Clears the package cache |
|
| Lists all the packages in the cache |
|
| Adds a package to the cache without installing it |
|
| Removes a specific package from the cache |
|
| Displays information about why a package is installed |
|
| Lists the licenses of installed packages |
| - | Generates a license disclaimer for the project |
| - | Interactively upgrades packages to their latest versions |
|
| Optimizes the dependency tree by deduplicating packages |
|
| Clears the Yarn or npm cache |
|
| Displays detailed information about a specific package |
|
| Performs a security audit on installed packages |
|
| Fixes vulnerabilities found during the security audit |
| - | Imports a package into the project from an npm registry |
| - | Imports a Yarn plugin into the project |
| - | Lists the installed Yarn plugins |
| - | Removes a Yarn plugin from the project |
| - | Displays the active constraints for installed packages |
|
| Runs a command from a package without installing it |
|
| Updates the version of the project |