Closed Ivo-Balbaert closed 3 years ago
I know what's happening here, if you install node-fetch
v2.x the example works as expected, however in v3.x the node-fetch package is an ESM module. A lot of other packages are moving to ESM as well, an example that I had issues with is ora
(we use it in Clio). There are two solutions to this:
import
instead of require
in the generated codeI vote for the first solution.
Describe the bug I tried to run the 1st example:
I added node-fetch as instructed: clio deps add --npm node-fetch Added node-fetch@3.0.0 to the dependencies list in D:\Clio\own_projects\await\clio.toml
I got the error below:
To Reproduce
in folder of await project: clio run
See error:
D:\Clio\own_projects\await>clio run Info: Compiling from "D:\Clio\own_projects\await\clio.toml" Info: Creating build for target "js" √ Compiling source... √ Adding Clio start script... √ Installing npm dependencies (this may take a while)...
(node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:10112) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.
(Use
node --trace-warnings ...
to show where the warning was created) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js require() of ES modules is not supported. require() of D:\Clio\own_projects\await\build\node_modules\node-fetch\src\index.js from D:\Clio\own_projects\await\build\main.clio.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 index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Clio\own_projects\await\build\node_modules\node-fetch\package.json.(node:10112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) Terminate batch job (Y/N)? y
D:\Clio\own_projects\await>
Instead of node::10112 I also see node:9416 or node:711, number seems to be random I have to do CTRL-C + Y to get back to the command-line.
Expected behavior Output of json file displayed
Versions