Using yarn instead of npm
npm
is the default package manager, but Facebook, in collaboration with Exponent, Google, and Tilde, has since developed a better alternative, called yarn
, which we will use instead.
yarn
 (https://yarnpkg.com/en/) uses the same https://www.npmjs.com/ registry as the npm
CLI. Since they both just install packages inside node_modules
directories and write to package.json
, you can use npm
and yarn
interchangeably. The differences are in their methods for resolving and downloading dependencies.
Package version locking
When we specify our dependencies inside our package.json
file, we can use symbols to indicate a range of acceptable versions. For example, >version
means the installed version must be greater than a certain version, ~version
means approximately equivalent (which means it can be up to the next minor version), and ^version
means compatible (which usually means the highest version without a change in the major version). This means that given the same package...