w3resource

Getting started with yarn


The tutorial you are about to read is the first tutorial for a series on yarn.

What is yarn.

Yarn is a package manage you can use for your code. it enables you to use and share your code with other developers around the world. Yarn will do this quickly, securely and reliably such that you don't ever have to worry.

Why yarn

Yarn enables you to use the solutions created by other developers. It makes it easier for you to develop your software.

In the event that you encounter a problem, you can report the issues or contribute back, and then you can use yarn to keep it up to date when the problem is fixed.

Your codes will be shard through something that is called a package (sometimes this is referred to as a module). Typically, a package will contain the code that is being shared as well as a package.json file which will describe the package.

Yarn installation

For you to work with yarn, you will need to install it first. Ensure that you use a stable version of yarn for your operating system. Once this is done. You can now open your command prompt or terminal and type:

 yarn - - version 

This will show you the version of yarn you installed else, it will throw a command not registered error. Check that yarn is contained in your path.

Installing yarn is the first step to working with yarn, it enables you to create a yarn project, migrate from npm, if you want to create a yarn project you need to run yarn init.

Later on in this series you will create your own yarn package and publish it.

create your own yarn package and publish

Then you can add and manage dependencies, set up version control and continuous integration etc.