简体   繁体   English

构建失败,因为没有从 express-serve-static-core 导出 ParsedQs

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

I was faced with an error of [@types/express]-Type 'P' is not assignable to type 'ParamsArray' , the error was resolved by installing these specific packages "@types/express": "^4.17.8", "@types/express-serve-static-core": "^4.17.13" which throw a new error below.我遇到了[@types/express]-Type 'P' is not assignable to type 'ParamsArray'的错误,通过安装这些特定的包"@types/express": "^4.17.8", "@types/express-serve-static-core": "^4.17.13"在下面抛出一个新错误。 I have tried to downgrade "@types/express-serve-static-core" to "^4.17.5" and install qs , but none of these work.我试图将"@types/express-serve-static-core"降级为"^4.17.5"并安装qs ,但这些都不起作用。

Any suggestions on how to fix this error?关于如何解决此错误的任何建议?

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";

It seems to be a known problem with that package ( see this issue ).该软件包似乎是一个已知问题( 请参阅此问题)。 I don't think an update for that has been released yet, but in the meantime you can use --skipLibCheck to prevent tsc from looking into packages that deeply and finding that error.我认为尚未发布更新,但同时您可以使用--skipLibCheck来防止 tsc 深入查看包并发现该错误。 This thread explains what that flag does nicely.该线程解释了该标志的作用。

Here I found the solution by following the steps below:在这里,我按照以下步骤找到了解决方案:

  1. npm remove @types/express && npm add @types/express@latest npm 删除@types/express && npm 添加@types/express@latest
  2. delete the @types/express-serve-static-core删除@types/express-serve-static-core
  3. npm update @types/express-serve-static-core --depth 1 npm 更新@types/express-serve-static-core --depth 1
  4. npm remove @types/express && npm i @types/express-serve-static-core@latest npm 删除@types/express && npm i @types/express-serve-static-core@latest

Solved Problem解决问题

Thanks.谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM