How to install a list of many global packages with Yarn

jleeothon picture jleeothon · May 10, 2017 · Viewed 56.2k times · Source

yarn install -h suggests that the -g (global) option is DEPRECATED. How am I supposed to indicate that I want a bunch of packages (from package.json / yarn.lock files) to be installed globally?

Options I saw:

  • yarn global [command] has things such as ls and add but not install. add only works with particular package names, if I understand correctly. I already have my yarn.lock file ready, I don't want to repeat myself on the command line.
  • yarn global add each package one by one. Now my list of packages would be imperative instead of declarative.

Specifically, I'd like to use one executable from one of those packages.

Answer

vijay picture vijay · Jul 24, 2018

Simply type

yarn global add nodejs