Title: Improve the `ERR_AMBIGUOUS_MODULE_SYNTAX` error message · Issue #60322 · nodejs/node · GitHub
Open Graph Title: Improve the `ERR_AMBIGUOUS_MODULE_SYNTAX` error message · Issue #60322 · nodejs/node
X Title: Improve the `ERR_AMBIGUOUS_MODULE_SYNTAX` error message · Issue #60322 · nodejs/node
Description: module.exports; await 1; The above code snippet causes an ERR_AMBIGUOUS_MODULE_SYNTAX error, since module.exports cannot be used (CJS) in an ESM file. However, the error logged to the console, shown below, incorrectly assumes the error s...
Open Graph Description: module.exports; await 1; The above code snippet causes an ERR_AMBIGUOUS_MODULE_SYNTAX error, since module.exports cannot be used (CJS) in an ESM file. However, the error logged to the console, show...
X Description: module.exports; await 1; The above code snippet causes an ERR_AMBIGUOUS_MODULE_SYNTAX error, since module.exports cannot be used (CJS) in an ESM file. However, the error logged to the console, show...
Opengraph URL: https://github.com/nodejs/node/issues/60322
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve the `ERR_AMBIGUOUS_MODULE_SYNTAX` error message","articleBody":"```js\nmodule.exports;\n\nawait 1;\n```\n\nThe above code snippet causes an `ERR_AMBIGUOUS_MODULE_SYNTAX` error, since `module.exports` cannot be used (CJS) in an ESM file. However, the error logged to the console, shown below, incorrectly assumes the error stems from the use of a `require()`\n\n```\nReferenceError: Cannot determine intended module format because both require() and top-level await are present. If the code is intended to be CommonJS, wrap await in an async function. If the code is intended to be an ES module, replace require() with import.\n```","author":{"url":"https://github.com/avivkeller","@type":"Person","name":"avivkeller"},"datePublished":"2025-10-19T20:01:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/60322/node/issues/60322"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:474f1550-22bd-af48-4f72-a0651e6afdff |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A68E:1B2DBD:C35955:1023EB8:6A4C4685 |
| html-safe-nonce | f30df4408aa0ff575a55cd46bfdec6519dd5c109821ea73bcc6a135c380fdeb8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjhFOjFCMkRCRDpDMzU5NTU6MTAyM0VCODo2QTRDNDY4NSIsInZpc2l0b3JfaWQiOiI0MTI5MjI5MTkxMzQ1MDk2MzI1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bf587103a11e0b145c14262b82aa2775273e76a61aa9ce1fd2793b5df712c5b0 |
| hovercard-subject-tag | issue:3530393205 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/60322/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fc810866c8d59068a819372ffe1c66c64381ee6fd64746c34ca98ad35a6403c4/nodejs/node/issues/60322 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fc810866c8d59068a819372ffe1c66c64381ee6fd64746c34ca98ad35a6403c4/nodejs/node/issues/60322 |
| og:image:alt | module.exports; await 1; The above code snippet causes an ERR_AMBIGUOUS_MODULE_SYNTAX error, since module.exports cannot be used (CJS) in an ESM file. However, the error logged to the console, show... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | avivkeller |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3996b3b83990e134be6c099ab9a7f48f140ae80f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width