Search code examples
yarnpkgyarnpkg-v2

Getting into a yarn dev 'category'?


A Yarn Getting Started Recipe tells me how to install Typescript using yarn:

yarn add --dev typescript

But when I then type, for example, tcs app.ts for typescript to compile my app.ts file I get the error

zsh: command not found: tcs

How do I get into the dev 'category', which I specified in yarn add (docs)?


Solution

  • The command is actually tsc. If typescript is installed locally, you run it by yarn tsc.

    'dev' is not a 'category', it's a kind of dependency: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#devdependencies - only used when developing, in opposite to production where you may use yarn install --production because there's no need for typescript anymore. Only packages from https://docs.npmjs.com/cli/v8/configuring-npm/package-json#dependencies are installed then.