“node_modules/minimatch/dist/cjs/index””没有导出成员“IOptions”

Skh*_*haz 9 node.js typescript

我有一个要在 Firebase 函数上运行的 TypeScript 项目。

这是我的tsconfig.json

{
  "compilerOptions": {
    "lib": ["es2017"],
    "module": "commonjs",
    "noImplicitReturns": true,
    "outDir": "dist",
    "sourceMap": true,
    "target": "es2017",
    "esModuleInterop": true,
    "strict": true
  },
  "include": ["src"],
  "exclude": ["dist", "node_modules"]
}
Run Code Online (Sandbox Code Playgroud)

当我构建时(npm run build,运行 tsc)

我收到错误

node_modules/@types/glob/index.d.ts:29:42 - 错误 TS2694:命名空间 '"/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index"' 没有导出成员“IOptions”。

29 接口 IOptions 扩展 minimatch.IOptions {

编辑:错误发生在其他模块中。完整输出:

npm run build

> build
> npm run lint && tsc


> lint
> eslint --fix .

node_modules/@types/glob/index.d.ts:29:42 - error TS2694: Namespace '"/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index"' has no exported member 'IOptions'.

29     interface IOptions extends minimatch.IOptions {
                                            ~~~~~~~~

node_modules/@types/glob/index.d.ts:75:30 - error TS2724: '"/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?

75         minimatch: minimatch.IMinimatch;
                                ~~~~~~~~~~

node_modules/@types/rimraf/index.d.ts:33:21 - error TS2694: Namespace '"/opt/workspace/personal/kioskify-backend/functions/node_modules/glob/dist/mjs/index"' has no exported member 'IOptions'.

33         glob?: glob.IOptions | false | undefined;
                       ~~~~~~~~


Found 3 errors in 2 files.

Errors  Files
     2  node_modules/@types/glob/index.d.ts:29
     1  node_modules/@types/rimraf/index.d.ts:33
Run Code Online (Sandbox Code Playgroud)

还有其他类似的错误,可能是什么?

isa*_*acs 14

将 rimraf、glob 和 minimatch 升级到最新版本。删除@types所有三个的包。然后就可以正常工作了。

这三个现在都是用ts写的,@types是包造成了问题。

资料来源:这三篇都是我写的。


Skh*_*haz 1

删除rimraf解决了问题。