Skip to main content

JavaScript and Node.js package manager alternative.

# To install a global package under the `/usr/local` prefix... (ex: /usr/local/bin/prettier):
yarn global add prettier --prefix /usr/local

# To uninstall a global package under the `/usr/local` prefix... (ex: /usr/local/bin/prettier):
yarn global remove prettier --prefix /usr/local

# To upgrade a global package to the latest version under the `/usr/local` prefix... (ex: /usr/local/bin/prettier):
yarn global upgrade prettier@latest --prefix /usr/local

# NOTE: package will be installed to "$HOME/.config/yarn/global/node_modules/.bin"
# see more at https://yarnpkg.com/en/docs/cli/global

# -----------

# To install a module globally:
yarn global add <module_name>

# To install all dependencies referenced in the 'package.json' file (the 'install' is optional):
yarn install

# To install a module and save it as a dependency to the 'package.json' file (add '--dev' to save as a dev dependency):
yarn add <module_name>@<version>

# To uninstall a module and remove it from the 'package.json' file:
yarn remove <module_name>

# To interactively create a 'package.json' file:
yarn init

# To identify whether a module is a dependency and list other modules that depend upon it:
yarn why <module_name>