David
David

Reputation: 101

node_modules/minimatch/dist/cjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?

I have rimraf as a devDependency (v5.0.0). When I try to run a script using rimraf it gives me this error:

node_modules/@types/glob/index.d.ts:29:42 - error TS2694: Namespace '".../node_modules/minimatch/dist/cjs/index"' has no exported member 'IOptions'.
29     interface IOptions extends minimatch.IOptions {
                                            ~~~~~~~~

node_modules/@types/glob/index.d.ts:74:30 - error TS2724: '"...node_modules/minimatch/dist/cjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?

74         minimatch: minimatch.IMinimatch;
                                ~~~~~~~~~~


Found 2 errors in the same file, starting at: node_modules/@types/glob/index.d.ts:29

I manually removed the node_modules/@types/glob folder and the error is gone, rimraf works perfectly. The problem is that I don't have glob or minimatch or its types as dependencies on my project, so I'm not able to remove the dependency to solve the issue.

These are the dependencies that I have in my package.json:

"devDependencies": {
    "@open-wc/building-rollup": "2.0.1",
    "@open-wc/eslint-config": "7.0.0",
    "@open-wc/testing": "3.1.3",
    "@rollup/plugin-replace": "4.0.0",
    "@typescript-eslint/eslint-plugin": "5.20.0",
    "@typescript-eslint/parser": "5.20.0",
    "@web/dev-server": "0.1.30",
    "@web/test-runner": "0.13.27",
    "@web/test-runner-puppeteer": "0.10.5",
    "concurrently": "7.1.0",
    "deepmerge": "4.2.2",
    "eslint": "8.13.0",
    "eslint-config-prettier": "8.5.0",
    "husky": "7.0.4",
    "lint-staged": "12.4.0",
    "prettier": "2.6.2",
    "rimraf": "5.0.0",
    "rollup": "2.70.2",
    "rollup-plugin-copy": "3.4.0",
    "tslib": "2.3.1",
    "typescript": "4.6.3"
  }

I don't know if it's just rimraf that is causing the issue, or could be another one.

Appreciate the answers! :)

Upvotes: 9

Views: 7408

Answers (6)

am0wa
am0wa

Reputation: 8397

It was due to different glob versions... resolved by:

npm install -D glob 

Upvotes: 0

Dave Chong
Dave Chong

Reputation: 619

try

npm uninstall @types/glob

it resolved my issue

Upvotes: 1

I resolved similar issue just forcing to override glob and minimatch package. Maybe its not the right solution, but I saw many nested packages using differents versions for minimatch and glob so my first try was use the latest packages.

STEPS

1- I added at the end of package.json the next

 ... 
 "overrides": {
    "minimatch": "5.1.2",
    "glob": "8.1.0"
  },
 ...

2- After add to the package.json, I just need to prune:

npm prune

Optional: In case that dont work try to remove node_modules and package-lock.json

rm -rf node_modules; rm package-lock.json

and install again all modules/packages

npm install

Here the full example if you want to see where to add inside your package.json:

{
  "name": "foo",
  "version": "0.0.0",
  "dependencies": {
    "express": "expressjs/express",
    "mocha": "mochajs/mocha#4727d357ea",
    "module": "user/repo#feature/branch"
  },
  "overrides": {
    "minimatch": "5.1.2",
    "glob": "8.1.0"
  }
}

NPM Documentation

Upvotes: 12

Balogun Ridwan Ridbay
Balogun Ridwan Ridbay

Reputation: 670

I resolve this same issue by upgrading the minimatch package to version 3.0.3

Upvotes: 1

David
David

Reputation: 101

Issue resolved!

In my case it was an open-wc dependency which was causing the issue.

@open-wc/building-utils had an outdated version of minimatch.

To resolve the issue I just added the "@open-wc/building-utils": "2.0.1" to my package.json and forced an updated version.

Upvotes: 1

Stephen Ross
Stephen Ross

Reputation: 419

If i had to guess, it looks like one of your dependencies is having an issue with the version.

I would try deleting the package.json and reinstalling.

You can also read more about your particular issue here: https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/63967

EDIT: after some more research, I found that the @types packages for these specific dependencies might be causing the issue. Try removing them.

Upvotes: 4

Related Questions