Node.js 正在尝试使用Typescript生成Express的生产版本
我在下面运行时遇到了这个错误:Node.js 正在尝试使用Typescript生成Express的生产版本,node.js,typescript,express,Node.js,Typescript,Express,我在下面运行时遇到了这个错误:npm运行清除&tsc-p./tsconfig.app.json&&npm运行发布:build或tsc-p. 节点版本:v12.13.0 npm:v6.14.2 快车:4 有人已经有同样的问题了吗 > tsc -p . node_modules/@types/readable-stream/index.d.ts:14:15 - error TS2417: Class static side 'typeof _Readable' incorrectly ext
npm运行清除&tsc-p./tsconfig.app.json&&npm运行发布:build
或tsc-p.
节点版本:v12.13.0
npm:v6.14.2
快车:4
有人已经有同样的问题了吗
> tsc -p .
node_modules/@types/readable-stream/index.d.ts:14:15 - error TS2417: Class static side 'typeof _Readable' incorrectly extends base class static side 'typeof Readable'.
The types of '(new Stream.Readable.Duplex(...))._destroy' are incompatible between these types.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
14 declare class _Readable extends stream.Readable {
~~~~~~~~~
node_modules/@types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type 'Duplex'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/@types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type 'Writable'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/@types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type '_Readable'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/@types/readable-stream/index.d.ts:102:11 - error TS2720: Class '_Readable.PassThrough' incorrectly implements class 'import("stream").PassThrough'. Did you mean to extend 'import("stream").PassThrough' and inherit its members as a subclass?
Types of property '_destroy' are incompatible.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
102 class PassThrough extends Transform implements stream.PassThrough {
~~~~~~~~~~~
node_modules/@types/readable-stream/index.d.ts:138:18 - error TS2749: 'StringDecoder' refers to a value, but is being used as a type here.
138 decoder: StringDecoder | null;
~~~~~~~~~~~~~
node_modules/@types/readable-stream/index.d.ts:164:11 - error TS2720: Class '_Readable.Transform' incorrectly implements class 'import("stream").Transform'. Did you mean to extend 'import("stream").Transform' and inherit its members as a subclass?
Types of property '_destroy' are incompatible.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
164 class Transform extends Duplex implements stream.Transform {
~~~~~~~~~
Found 7 errors.
尝试添加
@types/node:“^12.12.7”
要在package.json中删除依赖项。那么
npm install
这对我有用。干杯 你最近把mac升级到Catalina了吗?