I have a bunch of simple .ts
files. NOT projects (i.e. standalone .ts scripts).
They use some node.js functionality.
TypeScript and node type definitions are installed via
npm install -g typescript
npm install -g @types/node
Problem: on windows I can run tsc foo.ts
with no problems. It transpiles .ts to .js just fine.
But on Ubuntu 16.04 it gives me error TS2304: Cannot find name 'require'
, error TS2304: Cannot find name 'process'
and etc.
Even if add /// <reference types="node" />
to the top of foo.ts
or add --types node
switch to tsc I get error TS2688: Cannot find type definition file for 'node'
.
It looks like installing some types globally works fine in Windows but not on Ubuntu, so I'm assuming that this is not by design. So is there a way to install them globally? Or more precisely: to reference globally installed type definitions on Ubuntu?