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

"ERR_REQUIRE_ESM" #22

Open
specialdevivery opened this issue Feb 11, 2023 · 6 comments
Open

"ERR_REQUIRE_ESM" #22

specialdevivery opened this issue Feb 11, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@specialdevivery
Copy link

i have successfully downloaded allhands but can't open it. i keep getting this error message:

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/viv/.npm-global/lib/node_modules/allhands/node_modules/public-ip/index.js from /Users/viv/.npm-global/lib/node_modules/allhands/bin/allhands.js not supported.
Instead change the require of index.js in /Users/viv/.npm-global/lib/node_modules/allhands/bin/allhands.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/Users/viv/.npm-global/lib/node_modules/allhands/bin/allhands.js:7:18) {
code: 'ERR_REQUIRE_ESM'
}

i have googled it and people have been able to resolve the problem with this code but somehow doesnt work for me ..

(async () => {
const { fileTypeFromFile } = await import('file-type');

const type = await fileTypeFromFile('fixture/fixture.gif');
console.log(type);
})();

@specialdevivery
Copy link
Author

Btw i am running on mac os 12.6.1 Do you have any suggestions?

also thank you so much for supporting artists with your code, this seems like a great tool!

@michaelpalumbo michaelpalumbo self-assigned this Feb 13, 2023
@michaelpalumbo michaelpalumbo added the bug Something isn't working label Feb 13, 2023
@michaelpalumbo
Copy link
Owner

Hi @specialdevivery thanks for the bug report and for wanting to try allhands!

I'll first try to replicate with a fresh install on my OSX machine. I too am running OSX Monterey. Will get back to you shortly

@michaelpalumbo
Copy link
Owner

aha. i am getting the same error!

/usr/local/lib/node_modules/allhands/bin/allhands.js:7
const publicIp = require('public-ip');
                 ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/local/lib/node_modules/allhands/node_modules/public-ip/index.js from /usr/local/lib/node_modules/allhands/bin/allhands.js not supported.
Instead change the require of index.js in /usr/local/lib/node_modules/allhands/bin/allhands.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/usr/local/lib/node_modules/allhands/bin/allhands.js:7:18) {
  code: 'ERR_REQUIRE_ESM'
}

Ok, i'll see what I can do.

michaelpalumbo added a commit that referenced this issue Feb 13, 2023
@michaelpalumbo
Copy link
Owner

@specialdevivery try reinstalling allhands now. The issue stemmed from an experimental feature that I had implemented for a single performance and since then it seems no one has wanted to use, so I've just removed that feature and it seems to work again!

note that also the installation command is now

npm i --location=global allhands

@specialdevivery
Copy link
Author

specialdevivery commented Feb 20, 2023 via email

@michaelpalumbo
Copy link
Owner

Hi @specialdevivery ah well that's progress, likely :D

Can you tell me what is returned by the following command?

npm --version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants