title: Node js + TypeSc + Babel "Error: Cannot find module 'koa'"
body: <ol>
  <li>I have cloned a <a href="https://github.com/microsoft/TypeScript-Babel-Starter" rel="nofollow noreferrer">demo</a> . after installing koa,koa-router etc, I got an error. Here is my index.ts file</li>
  </ol>
  
  <pre class="lang-js prettyprint-override"><code>import Koa from "koa"
  import Router from "koa-router"
  import logger from "koa-logger"
  import json from "koa-json"
  
  const app = new Koa()
  const router = new Router()
  
  router.get("/",async(ctx: any,next: any)=&gt;{
      ctx.body = {
          meg:"Hello world"
      }
      await next
  })
  
  app.use(logger())
  app.use(json())
  app.use(router.routes()).use(router.allowedMethods())
  
  app.listen(3000,()=&gt;console.log("app is running at 3000"))
  </code></pre>
  
  <p>Here is my package.json</p>
  
  <pre><code>{
    "name": "babel-typescript-sample",
    "version": "0.7.2",
    "license": "MIT",
    "scripts": {
      "type-check": "tsc --noEmit",
      "type-check:watch": "npm run type-check -- --watch",
      "build": "npm run build:types &amp;&amp; npm run build:js",
      "build:types": "tsc --emitDeclarationOnly",
      "build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline"
    },
    "devDependencies": {
      "@babel/cli": "^7.8.3",
      "@babel/core": "^7.8.3",
      "@babel/plugin-proposal-class-properties": "^7.8.3",
      "@babel/preset-env": "^7.8.3",
      "@babel/preset-typescript": "^7.8.3",
      "@types/koa": "^2.11.3",
      "typescript": "^3.7.5"
    },
    "dependencies": {
      "koa": "^2.11.0",
      "koa-bodyparser": "^4.3.0",
      "koa-json": "^2.0.2",
      "koa-logger": "^3.2.1",
      "koa-router": "^8.0.8"
    }
  }
  </code></pre>
  
  <p>my file structure loos like:</p>
  
  <pre><code>/-------
    -lib
      -index.js
      -index.d.ts
    -node_modules
    -src
      -index.ts
  </code></pre>
  
  <ol start="2">
  <li>Actually,before this ,when I run <code>npm run build</code>,I got error <code>src/index.ts:2:20 - error TS2307: Cannot find module 'koa-router'.</code> I write <code>koa-router.d.ts</code> myself, but I don't think it's a great idea, How do you guys resolve?</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/EVXrI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EVXrI.png" alt="struct"></a></p>