From 7df41bc3ba47b00621dbdb09a6d3c5e4b68ebc86 Mon Sep 17 00:00:00 2001 From: Sean Zhang Date: Tue, 21 Mar 2023 22:37:44 +0800 Subject: [PATCH] Fix ERR_REQUIRE_ESM $ nrm ls C:\Users\sean\AppData\Roaming\npm\node_modules\nrm\cli.js:9 const open = require('open'); ^ Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\sean\AppData\Roaming\npm\node_modules\nrm\node_modules\open\index.js from C:\Users\sean\AppData\Roaming\npm\node_modules\nrm\cli.js not supported. Instead change the require of index.js in C:\Users\sean\AppData\Roaming\npm\node_modules\nrm\cli.js to a dynamic import() which is available in all CommonJS modules. at Object. (C:\Users\sean\AppData\Roaming\npm\node_modules\nrm\cli.js:9:14) { code: 'ERR_REQUIRE_ESM' } Node.js v18.12.0 --- actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions.js b/actions.js index ab454ef..a10f852 100644 --- a/actions.js +++ b/actions.js @@ -1,4 +1,4 @@ -const open = require('open'); +const open = import('open'); const chalk = require('chalk'); const fetch = require('node-fetch');