简体   繁体   中英

Typescript not working with tsconfig.json

On running tsc --watch with tsconfig in project I am getting the error below. It requires types for react and redux in node.js.

error TS2688: Cannot find type definition file for 'abstract-leveldown'.
  The file is in the program because:
    Entry point for implicit type library 'abstract-leveldown'

error TS2688: Cannot find type definition file for 'bn.js'.
  The file is in the program because:
    Entry point for implicit type library 'bn.js'

error TS2688: Cannot find type definition file for 'body-parser'.
  The file is in the program because:
    Entry point for implicit type library 'body-parser'

error TS2688: Cannot find type definition file for 'connect'.
  The file is in the program because:
    Entry point for implicit type library 'connect'

error TS2688: Cannot find type definition file for 'debug'.
  The file is in the program because:
    Entry point for implicit type library 'debug'

error TS2688: Cannot find type definition file for 'express'.
  The file is in the program because:
    Entry point for implicit type library 'express'

error TS2688: Cannot find type definition file for 'express-jwt'.
  The file is in the program because:
    Entry point for implicit type library 'express-jwt'

error TS2688: Cannot find type definition file for 'express-serve-static-core'.
  The file is in the program because:
    Entry point for implicit type library 'express-serve-static-core'

error TS2688: Cannot find type definition file for 'express-unless'.
  The file is in the program because:
    Entry point for implicit type library 'express-unless'

error TS2688: Cannot find type definition file for 'firebase'.
  The file is in the program because:
    Entry point for implicit type library 'firebase'

error TS2688: Cannot find type definition file for 'graceful-fs'.
  The file is in the program because:
    Entry point for implicit type library 'graceful-fs'

Please explain why this is happening. Do I have set up the project in Github .

I uninstalled node.js and npm and reinstalled and still had the same problem. Then I noticed there was an npm and npm-cache folder and node_modules folder which uninstalling does not remove. When I removed them and reinstalled node voila. my code started working. My bet is that node_modules was probably guilty.

This happened to me when I switched branches but forgot to reinstall npm packages. So do:

npm install in the current branch and then try again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM