On some Linux systems (NixOS is a big one), FHS is not followed, which could lead to some directories (like /lib) missing.
In system.ts:detectAlpine() on line 51, there is no error checking on the readdirSync('/lib') which leads to the process simply failing. I think this could safely return false on a failure instead.
Example error message:
node:fs:1583
const result = binding.readdir(
^
Error: ENOENT: no such file or directory, scandir '/lib'
at Object.readdirSync (node:fs:1583:26)
at detectAlpine (/build/source/node_modules/.pnpm/@yao-pkg+pkg-fetch@3.5.25/node_modules/@yao-pkg/pkg-fetch/lib-es5/system.js:73:29)
at Object.<anonymous> (/build/source/node_modules/.pnpm/@yao-pkg+pkg-fetch@3.5.25/node_modules/@yao-pkg/pkg-fetch/lib-es5/system.js:81:16)
at Module._compile (node:internal/modules/cjs/loader:1706:14)
at Object..js (node:internal/modules/cjs/loader:1839:10)
at Module.load (node:internal/modules/cjs/loader:1441:32)
at Function._load (node:internal/modules/cjs/loader:1263:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
at Module.require (node:internal/modules/cjs/loader:1463:12) {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/lib'
}
Node.js v22.19.0
On some Linux systems (NixOS is a big one), FHS is not followed, which could lead to some directories (like
/lib) missing.In system.ts:detectAlpine() on line 51, there is no error checking on the readdirSync('/lib') which leads to the process simply failing. I think this could safely return
falseon a failure instead.Example error message: