Reposted from https://github.com/nodejs/help/issues/1717.
Linux HOSTNAME 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux--experimental-modulesrequest-promise-native, but stacktrace also points to psl and core node as suspect.Importing request-promise-native using ES6 module syntax on v11.4.0 or v11.5.0 causes a stacktrace which (I think) points to an error in core node:
kevin@rayquaza:~/tmp$ node --experimental-modules index.mjs
(node:13310) ExperimentalWarning: The ESM module loader is experimental.
TypeError: Cannot read property 'onReady' of undefined
at Module.load (internal/modules/cjs/loader.js:631:22)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:659:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/home/kevin/tmp/node_modules/psl/index.js:14:19)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
nvm install v11.4.0git clone https://gist.github.com/kj800x/f08f44305429bbf8fdd65f9991cb2a71 && cd f08f44305429bbf8fdd65f9991cb2a71request-promise-native and a package.json and a package-lock.jsonnpm inpm startnvm install v11.3.0npm startThe last three comments on this request-promise-native issue are related: https://github.com/request/request-promise-native/issues/1#issuecomment-450769515
This issue is also happening in the 10 LTS version, breaking in 10.15.3. See #26595.
I can confirm, we got the same error when trying to update from 10.15.1 to 10.15.3.
This also triggers the bug (Node.js v10.15.2 ok, v10.15.3 buggy):
import blockchainWalletService from 'blockchain-wallet-service'
See https://github.com/nodejs/node/issues/25310#issuecomment-474225219.
Was hoping there would be some progress with 12.x release. Are there any plans to fix it in the near future?
I am able to reproduce the bug, I think I am able to isolate it: https://github.com/nodejs/node/pull/27443/files
Steps to reproduce:
Execute the file with the --experimental-modules flag => crashes
Execute the file without the --experimental-modules flag => works fine
Unfortunately I didn't find a successful fix, I feel I don't have enough experience on the CJS loader to understand the bug. I am leaving my test available for anyone who wants to work on that.
This issue is also happening in the 12.2.0 version.
This issue is also happening in the
12.2.0version.
Also happening in the 12.1.0 version.
Most helpful comment
This issue is also happening in the 10 LTS version, breaking in 10.15.3. See #26595.