node_modules/express-openid-connect/index.d.ts:7:8 -错误TS7016:未能找到模块“openid-client”的声明文件

dldeef67  于 2023-06-22  发布在  Node.js
关注(0)|答案(1)|浏览(182)

尝试安装npm install express-openid-connect时遇到错误。库似乎无法找到openid-client。我试图通过安装类型,创建一个单独的d.ts文件与declare module 'openid-client';,降级express-openid-connectopenid-client库来解决这个问题,但没有成功。每次我都会收到不同的错误。有人能帮助解决这个问题吗?
下面是完整的stacktrace:

> npm run build

node_modules/express-openid-connect/index.d.ts:9:8 - error TS7016: Could not find a declaration file for module 'openid-client'. '/myproject/functions/node_modules/openid-client/lib/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/openid-client` if it exists or add a new declaration (.d.ts) file containing `declare module 'openid-client';`

9 } from 'openid-client';
         ~~~~~~~~~~~~~~~

node_modules/express-openid-connect/index.d.ts:11:15 - error TS2724: '"jose"' has no exported member named 'JSONWebKey'. Did you mean 'JSONWebKeySet'?

11 import type { JSONWebKey, KeyInput } from 'jose';
                 ~~~~~~~~~~

node_modules/express-openid-connect/index.d.ts:11:27 - error TS2305: Module '"jose"' has no exported member 'KeyInput'.

11 import type { JSONWebKey, KeyInput } from 'jose';
                             ~~~~~~~~

Found 3 errors in the same file, starting at: node_modules/express-openid-connect/index.d.ts:9
lsmd5eda

lsmd5eda1#

在尝试了很多不同的事情之后。我最终只是试图玩版本,出于某种原因,在某些时候我决定添加更具体的openid-client版本,它的工作!以下配置使其发生:

"express-openid-connect": "^2.7.3",
"openid-client": "^5.1.6",

我希望这对其他人有帮助,因为它非常烦人

相关问题