I have a simple repo at https://github.com/filipesilva/tsnode-typeroots that shows this issue.
To reproduce, do:
git clone https://github.com/filipesilva/tsnode-typeroots
cd tsnode-typeroots
npm install
npm run tsc
npm run tsnode
On a OSX machine, both npm scripts will complete successfully. On a Windows machine, npm run tsnode will fail compilation with the following error:
TSError: ⨯ Unable to compile TypeScript
Cannot find type definition file for 'node'. (2688)
index.ts (1,13): Cannot find name 'module'. (2304)
This can be fixed either by:
- installing
typescript@2.0
- adding
"typeRoots": [ "node_modules/@types" ] to compilerOptions in tsconfig.json
I believe this is a bug because the tsc compilation itself completes successfully, whereas the tsnode one does not.
I have a simple repo at https://github.com/filipesilva/tsnode-typeroots that shows this issue.
To reproduce, do:
On a OSX machine, both npm scripts will complete successfully. On a Windows machine,
npm run tsnodewill fail compilation with the following error:This can be fixed either by:
typescript@2.0"typeRoots": [ "node_modules/@types" ]tocompilerOptionsintsconfig.jsonI believe this is a bug because the
tsccompilation itself completes successfully, whereas thetsnodeone does not.