Where does Yarn add global binaries on Windows?

Nick picture Nick · Oct 26, 2016 · Viewed 7.9k times · Source

I'm on Windows 7, and I tried to install typescript with yarn:

yarn global add typescript

success Installed [email protected] with binaries:
  - tsc
  - tsserver
Done in 11.59s.

After successful installation, I type tsc in the command line, only to find that the command is not available.

yarn tsc
yarn tsc v0.16.1
error Command "tsc" not found.

Get config:

yarn config get prefix
C:\Program Files (x86)\Nodist\bin

I checked this path: there's no tsc or tsserver exectuables. Where is it?

Answer

mikemaccana picture mikemaccana · Aug 13, 2018

Answering the actual question and using the default directory, rather than changing it:

Yarn installs to ${env:LOCALAPPDATA}\yarn\bin

You can see this with:

yarn global bin

For example, after installing gulp:

$ ls ${env:LOCALAPPDATA}\yarn\bin


    Directory: C:\Users\mike\AppData\Local\yarn\bin


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        13-Aug-18   4:11 PM            348 gulp
-a----        13-Aug-18   4:11 PM             57 gulp.cmd

To ensure it's in your path, add this to your $profile (assuming you have PSCX ):

Add-PathVariable ${env:LOCALAPPDATA}\yarn\bin