Rodrigo
Rodrigo

Reputation: 411

"node_modules/minimatch/dist/cjs/index"' has no exported member 'IOptions'

I have a TypeScript project to run on a Firebase function.

Here is my 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"]
}

When I build (npm run build, which runs tsc)

I got the error

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 {

EDIT: The error occurs in other modules. Full output:

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

And other similar errors, what can be?

Upvotes: 10

Views: 10031

Answers (4)

I have this error when using shelljs. Removing the types for me didn't work because @types/[email protected] just puts the types back in place.

$ npm ls @types/glob
    └─┬ @types/[email protected]
      └── @types/[email protected]

I had to remove the types from shelljs and glob:

$ npm rm @types/shelljs @types/glob

and then do the following:

// @ts-expect-error 7016
import shell from 'shelljs' 
const shx: any = shell

See also: https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/69867

Upvotes: 0

Suhail Akhtar
Suhail Akhtar

Reputation: 2023

Downgrading the rimraf package to version ^3.0.2 fixed the issue for me.

npm i rimraf@^3.0.2

Upvotes: -1

isaacs
isaacs

Reputation: 17170

Upgrade rimraf, glob, and minimatch to latest. Remove the @types packages for all three. Then it'll work fine.

These three are all written in ts now, the @types packages are causing the problem.

Source: I wrote all three of these.

Upvotes: 18

Rodrigo
Rodrigo

Reputation: 411

Removing rimraf solved the issue.

Upvotes: 2

Related Questions