TypeScript cannot find node module with index.d.ts
node-modules, typescript
Solution
I solved it by adding the following in my `tsconfig.json`:
{
"compilerOptions": {
"moduleResolution": "Node"
}
}
source
Problem
I'm trying to use EventEmmiter3 with the following syntax: ``` import EventEmitter from 'eventemitter3' ``` I have this module installed under the `./node_modules` folder. This module contains a `index.d.ts` so I think it should be detected by Typescript. But instead get the error: ``` [ts] Cannot find module 'eventemitter3'. ``` I tried adding `./node_modules` to the included types in my `tsconfig.json` without success: ``` { "compilerOptions": { "typeRoots": ["./node_modules", "./node_modules/@types"] } } ``` How should I configure Typescript to find node modules?