Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hm496 opened this issue Oct 14, 2021 · 2 comments
Open

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

hm496 opened this issue Oct 14, 2021 · 2 comments

Comments

@hm496
Copy link

hm496 commented Oct 14, 2021

$ 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
Copy link
Author

hm496 commented Nov 23, 2021

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

@szfdiwang
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants