main/nodejs: ERR_INVALID_URL_SCHEME inside node:internal/esm/resolve
other reports seem to come from alpine linux specifically as well. https://github.com/nodejs/node/issues/51096
does not happen on nodejs-current (21.4.0). quick repro (with npm installed):
$ npx rimraf@5.0.5
Need to install the following packages:
rimraf@5.0.5
Ok to proceed? (y)
node:internal/modules/esm/resolve:205
const resolvedOption = FSLegacyMainResolve(packageJsonUrlString, packageConfig.main, baseStringified);
^
TypeError: The URL must be of scheme file:
at legacyMainResolve (node:internal/modules/esm/resolve:205:26)
at packageResolve (node:internal/modules/esm/resolve:831:14)
at moduleResolve (node:internal/modules/esm/resolve:901:20)
at defaultResolve (node:internal/modules/esm/resolve:1121:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
at link (node:internal/modules/esm/module_job:84:36) {
code: 'ERR_INVALID_URL_SCHEME'
}
Node.js v20.10.0