簡體   English   中英

構建失敗,因為沒有從 express-serve-static-core 導出 ParsedQs

[英]Build failed because of no export of ParsedQs from express-serve-static-core

我遇到了[@types/express]-Type 'P' is not assignable to type 'ParamsArray'的錯誤,通過安裝這些特定的包"@types/express": "^4.17.8", "@types/express-serve-static-core": "^4.17.13"在下面拋出一個新錯誤。 我試圖將"@types/express-serve-static-core"降級為"^4.17.5"並安裝qs ,但這些都不起作用。

關於如何解決此錯誤的任何建議?

node_modules/@types/express-serve-static-core/index.d.ts:30:10 - error TS2305: Module '"../qs"' has no exported member 'ParsedQs'.

30 import { ParsedQs } from "qs";

該軟件包似乎是一個已知問題( 請參閱此問題)。 我認為尚未發布更新,但同時您可以使用--skipLibCheck來防止 tsc 深入查看包並發現該錯誤。 該線程解釋了該標志的作用。

在這里,我按照以下步驟找到了解決方案:

  1. npm 刪除@types/express && npm 添加@types/express@latest
  2. 刪除@types/express-serve-static-core
  3. npm 更新@types/express-serve-static-core --depth 1
  4. npm 刪除@types/express && npm i @types/express-serve-static-core@latest

解決問題

謝謝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM