英文:
node_modules/glob/dist/mjs/index"' has no exported member 'IOptions'. && Minipass type error
问题
我正在尝试将glob从版本8.1.0升级到10.2.4(只要我有版本9.x.x或更高版本就可以)。@types/glob的版本是8.1.0。在运行npm run build
时,出现以下错误:
PS > npm run build
> identity.service@1.0.0 build
> npm run compile && node infrastructure/build-api && node infrastructure/build-cf && npm run api-spec-check
> identity.service@1.0.0 compile
> tsc -p ./
infrastructure/copy-files.ts:15:27 - error TS2694: Namespace '"C:/Users/YashRaniga/Documents/dev/identity-service/node_modules/glob/dist/mjs/index"'没有导出成员'IOptions'。
15 let globOptions: glob.IOptions = {};
~~~~~~~~
node_modules/glob/node_modules/minipass/index.d.ts:148:3 - error TS2416: 类型'Minipass<RType, WType, Events>'中的属性'on'无法分配给基类型'Stream'中的相同属性。
类型'<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this'无法分配给类型'(eventName: string | symbol, listener: (...args: any[]) => void) => this'。
参数'type'和'eventName'的类型不兼容。
类型'string | symbol'不能分配给类型'Events'的键。
类型'symbol'不能分配给类型'Events'的键。
类型'symbol'不能分配给类型'Events<RType>'的键。
148 on<Event extends keyof Events>(
~~
node_modules/glob/node_modules/minipass/index.d.ts:153:3 - error TS2416: 类型'Minipass<RType, WType, Events>'中的属性'once'无法分配给基类型'Stream'中的相同属性。
类型'<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this'无法分配给类型'(eventName: string | symbol, listener: (...args: any[]) => void) => this'。
参数'type'和'eventName'的类型不兼容。
类型'string | symbol'不能分配给类型'Events'的键。
类型'symbol'不能分配给类型'Events'的键。
153 once<Event extends keyof Events>(
~~~~
node_modules/glob/node_modules/minipass/index.d.ts:158:3 - error TS2416: 类型'Minipass<RType, WType, Events>'中的属性'addListener'无法分配给基类型'Stream'中的相同属性。
类型'<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this'无法分配给类型'(eventName: string | symbol, listener: (...args: any[]) => void) => this'。
参数'type'和'eventName'的类型不兼容。
类型'string | symbol'不能分配给类型'Events'的键。
类型'symbol'不能分配给类型'Events'的键。
158 addListener<Event extends keyof Events>(
~~~~~~~~~~~
类型'symbol'不能分配给类型'Events'的键。
163 emit<Event extends keyof Events>(ev: Event, ...data: Events[Event]): boolean
~~~~
在2个文件中找到了5个错误。
错误 文件
1 infrastructure/copy-files.ts:15
4 node_modules/glob/node_modules/minipass/index.d.ts:148
经过多次查看Stack Overflow的帖子,没有一个有效。看到一个帖子中似乎不需要@types/glob,但移除它并没有解决问题。运行npm install minipass
也没有修复minipass错误。
英文:
I am currently trying to upgrade glob from version 8.1.0 to 10.2.4 (as long as I have version 9.x.x or higher it's fine). @types/glob version is 8.1.0. When running npm run build
, the following error comes:
PS > npm run build
> identity.service@1.0.0 build
> npm run compile && node infrastructure/build-api && node infrastructure/build-cf && npm run api-spec-check
> identity.service@1.0.0 compile
> tsc -p ./
infrastructure/copy-files.ts:15:27 - error TS2694: Namespace '"C:/Users/YashRaniga/Documents/dev/identity-service/node_modules/glob/dist/mjs/index"' has no exported member 'IOptions'.
15 let globOptions: glob.IOptions = {};
~~~~~~~~
node_modules/glob/node_modules/minipass/index.d.ts:148:3 - error TS2416: Property 'on' in type 'Minipass<RType, WType, Events>' is not assignable to the same property in base type 'Stream'.
Type '<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this' is not assignable to type '(eventName: string | symbol, listener: (...args: any[]) => void) => this'.
Types of parameters 'ev' and 'eventName' are incompatible.
Type 'string | symbol' is not assignable to type 'keyof Events'.
Type 'symbol' is not assignable to type 'keyof Events'.
Type 'symbol' is not assignable to type 'keyof Events<RType>'.
148 on<Event extends keyof Events>(
~~
node_modules/glob/node_modules/minipass/index.d.ts:153:3 - error TS2416: Property 'once' in type 'Minipass<RType, WType, Events>' is not assignable to the same property in base type 'Stream'.
Type '<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this' is not assignable to type '(eventName: string | symbol, listener: (...args: any[]) => void) => this'.
Types of parameters 'ev' and 'eventName' are incompatible.
Type 'string | symbol' is not assignable to type 'keyof Events'.
Type 'symbol' is not assignable to type 'keyof Events'.
153 once<Event extends keyof Events>(
~~~~
node_modules/glob/node_modules/minipass/index.d.ts:158:3 - error TS2416: Property 'addListener' in type 'Minipass<RType, WType, Events>' is not assignable to the same property in base type 'Stream'.
Type '<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this' is not assignable to type '(eventName: string | symbol, listener: (...args: any[]) => void) => this'.
Types of parameters 'ev' and 'eventName' are incompatible.
Type 'string | symbol' is not assignable to type 'keyof Events'.
Type 'symbol' is not assignable to type 'keyof Events'.
158 addListener<Event extends keyof Events>(
~~~~~~~~~~~
Type 'symbol' is not assignable to type 'keyof Events'.
163 emit<Event extends keyof Events>(ev: Event, ...data: Events[Event]): boolean
~~~~
Found 5 errors in 2 files.
Errors Files
1 infrastructure/copy-files.ts:15
4 node_modules/glob/node_modules/minipass/index.d.ts:148
Gone through multiple stack overflow threads, none of them have worked. Saw one thread where apparently @types/glob isn't required but removing that didn't work. Running npm install minipass
also didn't fix the minipass errors
答案1
得分: 0
glob.IOptions
不再存在。它只是从glob包导入的GlobOptions
。
最新的minipass版本已经修复了minipass错误。
英文:
glob.IOptions
is no longer a thing. It's just GlobOptions, imported from the glob package.
The minipass error was fixed on the latest minipass version.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论