首页 > 解决方案 > 由于打字稿文件,运行节点 js 应用程序时出错

问题描述

这些是即将出现的错误:

D:\agent-master>npm run build

> agent@0.1.0 build D:\agent-master
> tsc

node_modules/@types/whatwg-fetch/index.d.ts(6,1): error TS2688: Cannot find type definition file for 'whatwg-streams'.
node_modules/@types/whatwg-fetch/index.d.ts(97,11): error TS2304: Cannot find name 'ReadableStream'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! agent@0.1.0 build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the agent@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\tushar.gupta\AppData\Roaming\npm-cache\_logs\2019-12-12T13_36_11_813Z-debug.log

标签: node.jstypescriptnpm

解决方案


看起来您可能缺少@types/node包含所有类型的包,包括ReadableStream特定于节点的类型。尝试安装它,看看它是否能解决您的问题


推荐阅读