yarn has most of the functionality for the npm CLI. The following table compares the corresponding commands:
Yarn 0.24.5 | npm CLI 5.0.0 | Description |
yarn | npm | Alias for yarn install |
yarn install | npm install | Installs dependencies specified in yarn.lock and package.json |
yarn add <package> | npm install <package> | Installs the package, adds it to the dependencies list, and generates lock files (prior to 5.0.0, npm CLI required a --save flag) |
yarn remove <package> | npm uninstall <package> | Uninstalls the package |
yarn global add <package> | npm install <package> --global | Installs a package globally |
yarn upgrade | rm -rf node_modules && npm install | Upgrades all packages to the latest version, as allowed by ... |