nota icon indicating copy to clipboard operation
nota copied to clipboard

[Dependency] "node_modules\\minimatch\\dist\\cjs\\index" has no exported member named `IMinimatch`. Did you mean 'Minimatch'?

Open Bistard opened this issue 2 years ago • 4 comments

Describe the bug

Compilation error (To see more details, there is a screenshot below):

ERROR in P:\dev\nota\node_modules\@types\glob\index.d.ts
29:41-49
[tsl] ERROR in P:\dev\nota\node_modules\@types\glob\index.d.ts(29,42)
      TS2694: Namespace '"P:\\dev\\nota\\node_modules\\minimatch\\dist\\cjs\\index"' has no exported member 'IOptions'.
ts-loader-default_e3b0c44298fc1c14

ERROR in P:\dev\nota\node_modules\@types\glob\index.d.ts
74:29-39
[tsl] ERROR in P:\dev\nota\node_modules\@types\glob\index.d.ts(74,30)
      TS2724: '"P:\\dev\\nota\\node_modules\\minimatch\\dist\\cjs\\index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?
ts-loader-default_e3b0c44298fc1c14

To Reproduce

  1. In the dev-editor branch, immediately after the PR from the dev (Commit ID: 251fb37cf35207a61c47e46fcab022e1ce8b092a), the above compilation error shows up.

Additional Context

  1. After browsing some solutions on the internet, I found out the following resources are useful to understand the weird behaviour behind it.
  2. This StackOverflow answer do solve my problem by doing the following in package.json:
"overrides": {
	"minimatch": "5.1.2",
	"glob": "8.1.0"
}
  1. This is also a potential correct understanding of the problem (BendingBender's reply): https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/63967
  2. I believe the glob team themselves have already been aware of the issue since last year, they did update to the correct version. 4.1 But since this valuable error is still somehow able to trigger (like in our case), I believe there is a deep hard-to-discover weird dependency-dependency version issue under our package-lock.json that triggers this error without being detected by npm. 4.2 I tried to iterate every dependency that depends on glob and minimatch and fix their version. I couldn't really find it. So I choose to simply override the minimatch version to 5.1.2 and solves the problem. 4.3 glob team related issues:
    • https://github.com/isaacs/node-glob/issues/490
    • https://github.com/isaacs/node-glob/pull/489

Screenshots

image

Bistard avatar Apr 08 '24 23:04 Bistard

The issue should be fixed under dev-editor since it only triggers after merging to dev-editor. But I am going to fix this under dev branch since I am currently doing a merge from dev to dev-editor anyway.

Bistard avatar Apr 08 '24 23:04 Bistard

Cannot simply override every minimatch or glob to a specific version. I need to find the source of the bug first.

Bistard avatar Apr 09 '24 22:04 Bistard

The issue still happens in the dev-editor branch. F myself.

Bistard avatar May 11 '24 14:05 Bistard

The author of rimraf, glob, and minimatch replied:

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.

My plan is to introduce a new script named postinstall.js which will delete node_modules/@types/glob manually after npm install.

Ref: https://stackoverflow.com/questions/75890950/node-modules-minimatch-dist-cjs-index-has-no-exported-member-ioptions#comment137653603_75950982

Bistard avatar May 17 '24 20:05 Bistard