akamai / cli-netstorage

Apache License 2.0
15 stars 14 forks source link

akamai netstorage command fails in macOS - Error [ERR_REQUIRE_ESM]: require() of ES Module #31

Open darthega opened 1 year ago

darthega commented 1 year ago

This is a weird case I haven't found any reference to:

We have an Azure pipeline that installs akamai cli via brew in a MacOS VM, then uses akamai install to get netstorage, all the installation process succeeds, but when executing any akamai netstorage command, the CLI returns a JS error:

/Users/<user-name>/.akamai-cli/src/cli-netstorage/bin/akamaiNetstorage:26
let untildify = require('untildify');
                ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/<user-name>/.akamai-cli/src/cli-netstorage/node_modules/untildify/index.js from /Users/<user-name>/.akamai-cli/src/cli-netstorage/bin/akamaiNetstorage not supported.

I've tried several different versions of MacOS with and all reproduce the same issue, I'm also able to reproduce it locally after installing akamai cli via brew [ref] and also via binary file download [ref].

I've also tried different nodejs versions using nvm to no avail.

Further more, around 6 months ago (last time this pipeline was executed) it succeeded, my assumption is that something changed inside the netstorage package, most likely their dependency version for untildify, and it is breaking the execution.

Steps to reproduce

Screenshots Azure execution:

Screenshot 2023-06-20 at 10 44 34

Local execution:

Screenshot 2023-06-20 at 10 46 44
darthega commented 1 year ago

I just found this PR that might be related: https://github.com/akamai/cli-netstorage/pull/30

femueller commented 1 year ago

+1

anikitin commented 11 months ago

Please fix it, it took me a couple of hours today in attempts to work around this issue!