Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using NODE_OPTIONS=--experimental-specifier-resolution=node with some .bin executables #35518

Closed
daveisfera opened this issue Oct 6, 2020 · 9 comments
Labels
confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation.

Comments

@daveisfera
Copy link

  • Version: 14.13.0
  • Platform: macOS 10.15.6
  • Subsystem:

What steps will reproduce the bug?

NODE_OPTIONS=--experimental-specifier-resolution=node node_modules/.bin/semver --version

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'
}

Additional information

Also happens with he, mocha, node-which, and tsc

@targos
Copy link
Member

targos commented Oct 11, 2020

I can't reproduce it on Linux.

@sionzee
Copy link

sionzee commented 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
Copy link

sionzee commented 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
Copy link
Author

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

@targos targos added confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation. labels Dec 27, 2020
@targos
Copy link
Member

targos commented Dec 27, 2020

I can reproduce now with:

> 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'
}

@nodejs/modules

@Norbo11
Copy link

Norbo11 commented 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
Copy link
Contributor

sosoba commented 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
Copy link

iambumblehead commented 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
Screen Shot 2023-07-27 at 8 43 19 PM

any suggestions for resolving the issue would be very welcome

@GeoffreyBooth
Copy link
Member

Node 14 is EOL and this flag was removed years ago. Closing.

@GeoffreyBooth GeoffreyBooth closed this as not planned Won't fix, can't repro, duplicate, stale Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

No branches or pull requests

7 participants