TS cannot find modules

TypeScript relies on definition files that define the types, interfaces, etc. for libraries. I’m not familiar with FountainJS, but I’m guessing it’s smart enough to create a typings.json file in your workspace. If so, all you need to do is install typings (npm install typings --global) and then use it to install the definitions by doing typings install.

If they didn’t include typings.json (though I can’t imagine they wouldn’t), follow the instructions on their README to search for and install definitions for the dependencies.

I generally add the following lines to package.json so that the typings will be installed automatically any time you run npm install

"scripts": { "postinstall": "npm run typings", "typings": "typings install", }

If you’re not familiar with TypeScript, I recommend going through their basic tutorial to get you started: https://www.typescriptlang.org/docs/tutorial.html.

Leave a Comment