Install via npm
npm install --global yarn
Check installation
yarn --version
Starting a new project
yarn init
Adding a dependency
yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]
Adding a dependency to different categories of dependencies
Add to devDependencies
, peerDependencies
, and optionalDependencies
respectively:
yarn add [package] --dev
yarn add [package] --peer
yarn add [package] --optional
Upgrading a dependency
yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]
Removing a dependency
yarn remove [package]
Installing all the dependencies of project
yarn
or
yarn install
Top comments (2)
Always heard installing yarn this way wasn't recommended. I need to see if that is accurate or not.
Ya, sure if this is good practice of yarn setup, then please share yours if possible. thank you.