-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
Environments:
- Prettier Version: b40509c (main)
- Running Prettier via: Node.js
- Runtime: Node.js 22.12.0
- Operating System: Windows
- Prettier plugins (if any): N/A
Steps to reproduce:
node --version
git clone https://github.com/prettier/prettier.git
cd prettier
yarn
yarn test
node --run test
Expected behavior:
(Test succeeds twice)
Actual behavior:
v22.12.0
Error [ERR_REQUIRE_ASYNC_MODULE]: require() cannot be used on an ESM graph with top-level await. Use import() instead. To see where the top-level await comes from, use --experimental-print-required-tla.
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:392:13)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:329:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1414:24)
at Module._compile (node:internal/modules/cjs/loader:1547:5)
at Object..js (node:internal/modules/cjs/loader:1677:16)
at Module.load (node:internal/modules/cjs/loader:1318:32)
at Function._load (node:internal/modules/cjs/loader:1128:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
git diff package.json
diff --git a/package.json b/package.json
index 49cdf6f39..7635ebe4a 100644
--- a/package.json
+++ b/package.json
@@ -158,7 +158,7 @@
},
"scripts": {
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
- "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand",
+ "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-print-required-tla\" jest --runInBand",
"test:dev-package": "cross-env INSTALL_PACKAGE=1 yarn test",
"test:dist": "cross-env NODE_ENV=production yarn test",
"test:dist-standalone": "cross-env TEST_STANDALONE=1 yarn test:dist",β
Error: unexpected top-level await at file:///D:/prettier/node_modules/temp-dir/index.js:4
const temporaryDirectory = await fs.realpath(os.tmpdir());
^
Error: require() cannot be used on an ESM graph with top-level await. Use import() instead. To see where the top-level await comes from, use --experimental-print-required-tla.
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:395:35)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:329:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1414:24)
at Module._compile (node:internal/modules/cjs/loader:1547:5)
at Object..js (node:internal/modules/cjs/loader:1677:16)
at Module.load (node:internal/modules/cjs/loader:1318:32)
at Function._load (node:internal/modules/cjs/loader:1128:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
yarn why temp-dir
ββ tempy@npm:3.1.0
ββ temp-dir@npm:3.0.0 (via npm:^3.0.0)
Metadata
Metadata
Assignees
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.