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
v12.16.2

% 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): Error [ERR_REQUIRE_ESM] with `netlify link` ยท Issue #868 ยท netlify/cli ยท GitHub

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!