Blogs
/
Yarn Commands
Yarn Commands

What is Yarn?

Yarn is a JavaScript package manager created by Facebook. It helps to install packages from the npm registry and is similar to npm.

Yes, that's all you need to know about Yarn. Let's learn the basic commands of Yarn, open your terminal and let’s go!

Yarn Commands:

yarn -v - to check the version of yarn.

yarn help - to get help on Yarn commands or know more commands.

yarn init - To create a package.json file for a new or existing project.

yarn add ‘package name’ - To install a package and add it to the dependencies in package.json.

yarn remove ‘package name’ - To remove a package from the dependencies in package.json.

yarn install - will install all the dependencies listed in the package.json file.

yarn outdated - to find the outdated versions of dependencies

yarn upgrade ‘package name’ - to upgrade the package

yarn global add ‘package name’ - to install the package globally

yarn list - to list all packages installed in your project.

yarn import - imports yarn.lock if deleted

yarn run dev - to run development scripts

yarn licenses list - to check the licenses of packages

yarn pack - creates a g-zip file of the package

yarn cache list - to see the cache list

yarn cache clean - to clean the cache

yarn run build - bundles the app into static files for production

In conclusion, Yarn is a great tool that can help simplify the process of managing your JavaScript packages. Knowing these commands will make it easier to work with Yarn.

Subscribe to the Newsletter!