Skip to content

'got' is now an ESM module, require => import #1

Description

@remkolodder

Hello,

When I install vmw-cli on Ubuntu 20.04 (npm install vmw-cli --global), and when running it, I get an error:

/usr/local/lib/node_modules/vmw-cli/node_modules/vmw-sdk/lib/vmw-sdk.js:2
const got = require('got');
            ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/local/lib/node_modules/vmw-cli/node_modules/got/dist/source/index.js from /usr/local/lib/node_modules/vmw-cli/node_modules/vmw-sdk/lib/vmw-sdk.js not supported.
Instead change the require of index.js in /usr/local/lib/node_modules/vmw-cli/node_modules/vmw-sdk/lib/vmw-sdk.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/usr/local/lib/node_modules/vmw-cli/node_modules/vmw-sdk/lib/vmw-sdk.js:2:13)
    at Object.<anonymous> (/usr/local/lib/node_modules/vmw-cli/lib/vmw.api.js:3:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/vmw-cli/lib/vmw.cli.js:3:19) {
  code: 'ERR_REQUIRE_ESM'
}

Their documentation state that it is now an ESM module which has an import instead of require statement and some other changes. See https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c for more information.
This can probably be bypassed if we use version 11.8.2.

Can you please update the SDK to match that version and/or update the usage to the now forced usage?

Thanks :)
(probably you can make the change to package.json file and specify "11.8.2" instead of "*".)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions