Typescript: "Cannot find module" with valid typings
<p>I just started a new nodejs project using typescript. I installed Typings (<a href="https://github.com/typings/typings" rel="noreferrer">https://github.com/typings/typings</a>) and used that to install reference files for node v4.x and express v4.x.</p>

<p>My node version is v4.2.6
My typescript version is v1.7.5</p>

<p>My project directory is laid out thus:</p>

<pre><code>package.json
tsconfig.json
typings.json
src/
  app.ts
typings/
  main.d.ts
  main/ambient/node/node.d.ts
  main/ambient/express/express.d.ts
</code></pre>

<p>The contents of typings/main.d.ts are as follows:</p>

<pre><code>/// &lt;reference path="main/ambient/express/express.d.ts" /&gt;
/// &lt;reference path="main/ambient/node/node.d.ts" /&gt;
</code></pre>

<p>The contents of tsconfig.json are as follows:</p>

<pre><code>{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs"
  }
}
</code></pre>

<p>The contents off typings.json are as follows:</p>

<pre><code>{
  "dependencies": {},
  "devDependencies": {},
  "ambientDependencies": {
    "express": "github:DefinitelyTyped/DefinitelyTyped/express/express.d.ts#dd4626a4e23ce8d6d175e0fe8244a99771c8c3f2",
    "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#1c56e368e17bb28ca57577250624ca5bd561aa81"
  }
}
</code></pre>

<p>The contents of src/app.ts are as follows:</p>

<pre><code>'use strict';

///&lt;reference path="../typings/main.d.ts"/&gt;

import * as express from "express";
</code></pre>

<p>This is exceedingly simple and should result in a basic app. However, when I try to compile this I get the error <code>error TS2307: Cannot find module 'express'.</code> </p>

<p>I have tried rearranging typings files, changing the relative path in the reference path tag, using the <code>files</code> field in tsconfig.json to indicate the reference paths instead of using an inline tag in the file, all to no avail. I have also tried compiling using <code>gulp-typescript</code>, <code>gulp-tsc</code>, and <code>tsc</code> directly on the command line.</p>

<p>I get similar errors when I try to use nodejs build-in modules such as <code>crypto</code>, <code>http</code>, <code>fs</code> etc.</p>

<p>These references seem valid -- what am I missing? </p>