You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crash when using NODE_OPTIONS=--experimental-specifier-resolution=node with some .bin executables #35518
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior?
Runs just like when NODE_OPTIONS isn't set
What do you see instead?
This error:
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected string to be returned for the "format" from the "loader getFormat" function but got type object.
at Loader.getFormat (internal/modules/esm/loader.js:110:13)
at async Loader.getModuleJob (internal/modules/esm/loader.js:230:20)
at async Loader.import (internal/modules/esm/loader.js:164:17)
at async Object.loadESM (internal/process/esm_loader.js:68:5) {
code: 'ERR_INVALID_RETURN_PROPERTY_VALUE'
}
I just tested with semver with 14.12.0 and it ran with no output, but mocha gave the same error, so I believe that it happened at least some of the time before 14.13.0
> npm i semver
> NODE_OPTIONS=--experimental-specifier-resolution=node node_modules/.bin/semver
node:internal/process/esm_loader:74
internalBinding('errors').triggerUncaughtException(
^
TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected string to be returned for the "format" from the "loader getFormat" function but got type object.
at new NodeError (node:internal/errors:278:15)
at Loader.getFormat (node:internal/modules/esm/loader:111:13)
at async Loader.getModuleJob (node:internal/modules/esm/loader:231:20)
at async Loader.import (node:internal/modules/esm/loader:165:17)
at async Object.loadESM (node:internal/process/esm_loader:68:5) {
code: 'ERR_INVALID_RETURN_PROPERTY_VALUE'
}
Activity
targos commentedon Oct 11, 2020
I can't reproduce it on Linux.
sionzee commentedon Oct 11, 2020
I have the same issue but started happening on 14.13.1 and not 14.13.0 which was working fine.
// Edit
In my case it is with ts-node.
sionzee commentedon Oct 11, 2020
I think this error is happening due changes with esm-loader and is not related to NODE_OPTIONS.
@daveisfera Can I ask to confirm if this really began happening on 14.13.0?
Just if my theory is right :)
If you are right then I must create another issue.
daveisfera commentedon Oct 14, 2020
I just tested with
semverwith 14.12.0 and it ran with no output, butmochagave the same error, so I believe that it happened at least some of the time before 14.13.0targos commentedon Dec 27, 2020
I can reproduce now with:
@nodejs/modules
Norbo11 commentedon Dec 27, 2020
Also seeing this when running mocha via node v14.13.1, Mac OSX 10.15.1. Running the same command under my Ubuntu VM works fine.
sosoba commentedon Jan 26, 2021
It's not a bug but planing feature. See https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V13.md
[aa26662] - module: drop support for extensionless main entry points in esm (Geoffrey Booth) #31415
[ca81af7] - module: correct docs about when extensionless files are supported (Geoffrey Booth) #31415
iambumblehead commentedon Jul 28, 2023
the recent version node 18 lts, 18.17.0 seems have a related error, seen using the package here https://github.com/iambumblehead/esmock/tree/master/tests/tests-source-map
the error does not happen when node 18.16.x is used, only when 18.17.x
a link to a failed pipeline that shows the error is here https://github.com/iambumblehead/esmock/actions/runs/5688083279/job/15417439319?pr=217
and a screenshot of the error seen from a win32 virtual machine is seen here

any suggestions for resolving the issue would be very welcome
GeoffreyBooth commentedon Jul 28, 2023
Node 14 is EOL and this flag was removed years ago. Closing.