sudo npm install -g typescript
The -g option to npm install is short for --global and means install the said package globally (global npm directory) as opposed to the local node_modules folder of a project.
Binaries are then also exposed on your PATH, so you can run tsc conveniently.
Note that you need an up-to-date installation of Node to run TypeScript. If not, some of the modern operators (e.g. null coalescing operator) will not work when running tsc.
No comments:
Post a Comment