Yarn

Created: 2017 May 19th

Updated: 2021 Jan 4th

Edit this page on GitHub

Yarn global binaries not showing

When you globally add a package with yarn and it doesn’t show in the terminal.

Usually adding the path to your .bashrc or .zshrc works, try adding this:

# nano ~/.bashrc
# or
# nano ~/.zshrc
export PATH="$PATH:$(yarn global bin)"

If that doesn’t work you may need to set the yarn prefix.

Steps

Confirm your global bin path:

yarn global bin

I got: /home/username/.yarn/bin

set yarn prefix:

make sure your yarn prefix is the parent directory of your bin directory. You can confirm by running

yarn config get prefix

When I ran this it was undefined, so I set it:

yarn config set prefix ~/.yarn

Add the following to ~/.zshrc or ~/.bashrc

export PATH="$PATH:`yarn global bin`"

Source

Update dependencies

Update all project dependencies to lates versions.

yarn upgrade --latest

Globally add a package

yarn global add netlify-cli

Upgrade global packages

yarn global upgrade

displays the location of the yarn bin folder.

yarn bin

list installed packages.

yarn ls

create-react-app

Couple of good one here from @beedesignllc

yarn create react-app my-app-name

☝️ downloads and runs latest create-react-app works for other similarly named pkgs

flow

yarn flow

☝️ will run node_modules/.bin/flow without you having to add it as a package.json script.

npm ci

The equivalent to npm ci for yarn:

yarn install --frozen-lockfile
Scott avatar

Made with ❤️ by Scott Spence

Copyright © 2024 - All right reserved