Install packages globally on your operating system.
yarn global <add/bin/list/remove/upgrade> [--prefix]
yarn global is a prefix used for a number of commands like
remove. They behave identically to their normal versions except that they use a global directory to store packages. The
global command makes executables available to use on your operating system.
Note: Unlike the
--global flag in npm,
global is a command which must immediately follow
yarn add global package-name will add the packages named
package-name locally instead of adding
This is useful for developer tooling that is not part of any individual project but instead is used for local commands. One such example is create-react-app which can be installed globally like this:
$ yarn global add create-react-app --prefix /usr/local # the `create-react-app` command is now available globally: $ which create-react-app $ /usr/local/bin/create-react-app $ create-react-app
yarn global bin will output the location where Yarn will install symlinks to your installed executables. You can configure the base location with
yarn config set prefix <filepath>. For example,
yarn config set prefix ~/.yarn will ensure all global packages will have their executables installed to
yarn global dir will print the output of the global installation folder that houses the global
node_modules. By default that will be:
Read more about the commands that can be used together with
yarn add: add a package to use in your current package.
yarn bin: displays the location of the yarn bin folder.
yarn list: list installed packages.
yarn remove: remove a package that will no longer be used in your current package.
yarn upgrade: upgrade packages to their latest version based on the specified range.
yarn upgrade-interactive: similar to
upgradecommand, but display the outdated packages before performing any upgrade, allowing the user to select which packages to upgrade.
© 2016–2017 Yarn Contributors
Licensed under the BSD License.