Happy path broken: Must use import to load ES Module:

Heya :wave: –

It looks like basic happy path is broken on MacOS.

Fresh install, attempted to install Netlify CLI and use link:

% netlify link

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /usr/local/lib/node_modules/netlify-cli/node_modules/is-promise/index.js
require() of ES modules is not supported.
require() of /usr/local/lib/node_modules/netlify-cli/node_modules/is-promise/index.js from /usr/local/lib/node_modules/netlify-cli/node_modules/run-async/index.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 /usr/local/lib/node_modules/netlify-cli/node_modules/is-promise/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/local/lib/node_modules/netlify-cli/node_modules/is-promise/package.json.
at Object.<anonymous> (/usr/local/lib/node_modules/netlify-cli/node_modules/run-async/index.js:3:17)

% node -v

% netlify -v
netlify-cli/2.48.0 darwin-x64 node-v12.16.2

Aw dang, sorry to hear this! I’ve gone ahead and filed an issue with your report here if you want to track it (also feel free to drop in and add more info there): https://github.com/netlify/cli/issues/868

I had the same issue and this solved it:

brew uninstall netlify-cli

and then

brew install -s netlify-cli

1 Like

we have been doing a ton of work on the CLI lately, with new releases coming fast and furious. Always a good idea to check whether you have the latest version!