[英]Typescript not working with tsconfig.json
在项目中使用 tsconfig 运行 tsc --watch 时,出现以下错误。 它需要 react 类型和 node.js 中的 redux。
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'
请解释为什么会这样。 我在Github中是否设置了项目。
我卸载了 node.js 和 npm 并重新安装,仍然有同样的问题。 然后我注意到有一个 npm 和 npm-cache 文件夹和 node_modules 文件夹,卸载不会删除。 当我删除它们并重新安装节点时。 我的代码开始工作了。 我敢打赌 node_modules 可能是有罪的。
当我切换分支但忘记重新安装 npm 包时,这发生在我身上。 所以这样做:
npm install
在当前分支安装,然后重试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.