ecomfe / fontmin

Minify font seamlessly
http://ecomfe.github.io/fontmin
MIT License
5.62k stars 311 forks source link

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module #97

Closed hm496 closed 3 weeks ago

hm496 commented 2 years ago
$ node -v                                                            
v14.16.1

$ npm i -g fontmin

$ fontmin --help                                                        
internal/modules/cjs/loader.js:1080
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/home/.n/lib/node_modules/fontmin/node_modules/meow/index.js require() of ES modules is not supported. require() of /Users/home/.n/lib/node_modules/fontmin/node_modules/meow/index.js from /Users/home/.n/lib/node_modules/fontmin/cli.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/home/.n/lib/node_modules/fontmin/node_modules/meow/package.json.

hm496 commented 2 years ago

Downgrade dependencies version can solve this problem "meow": "^9.0.0", "get-stdin": "^8.0.0",

szfdiwang commented 2 years ago

Downgrade dependencies version can solve this problem "meow": "^9.0.0", "get-stdin": "^8.0.0", useful