|
|
|
|
|
by WorldMaker
1405 days ago
|
|
One other alternative to npm that is very useful for this specific case is npx. `npx typescript` will download typescript, cache it somewhere outside of the current project (often %LocalAppData% on Windows or near equivalent elsewhere), and then run it. You can run specific versions with `npx typescript@4`. You can follow that with command line arguments for typescript. npx is installed right alongside npm in Node installs for some time now. Learning npm is still often a good idea when working with Node. One thing that may be useful to learn here: npm has a concept of a development dependency needed only for development, not run time. You can install one with `npm install --save-dev typescript` for example. (Or `npm i -D typescript` if you want to save some typing.) You can clean out dev dependencies with `npm prune --production`. Or if you are in a fresh install situation (a fresh git clone, for instance) and you want to skip developer dependencies you can `npm install --omit=dev`. I find the distinction between production dependencies and developer dependencies quite useful. |
|