The issue involves a libuv assertion on Windows and requires deep knowledge of Node.js internals.
The issue involves a libuv assertion on Windows, likely due to incorrect usage of uv_async_send() after uv_close(). The problem was traced to a large PR (3143 files), making it difficult to pinpoint the exact source. Deep knowledge of Node.js internals and libuv is required to diagnose and fix.
23.x+
Windows
No response
Write the following file as registryServer.mjs:
registryServer.mjsThe original file is https://github.com/nodejs/corepack/blob/main/tests/_registryServer.mjs, I tried to trim the unrelated stuff but it's still a large file:
import { createHash, createSign, generateKeyPairSync } from "node:crypto";
import { once } from "node:events";
import { createServer } from "node:http";
import { gzipSync } from "node:zlib";
let privateKey, keyid;
({ privateKey } = generateKeyPairSync(`ec`, {
namedCurve: `sect239k1`,
}));
const { privateKey: p, publicKey } = generateKeyPairSync(`ec`, {
namedCurve: `sect239k1`,
publicKeyEncoding: {
type: `spki`,
format: `pem`,
},
});
privateKey ??= p;
keyid = `SHA256:${createHash(`SHA256`).end(publicKey).digest(`base64`)}`;
process.env.COREPACK_INTEGRITY_KEYS = JSON.stringify({
npm: [
{
expires: null,
keyid,
keytype: `ecdsa-sha2-sect239k1`,
scheme: `ecdsa-sha2-sect239k1`,
key: publicKey.split(`\n`).slice(1, -2).join(``),
},
],
});
function createSimpleTarArchive(fileName, fileContent, mode = 0o644) {
const contentBuffer = Buffer.from(fileContent);
const header = Buffer.alloc(512); // TAR headers are 512 bytes
header.write(fileName);
header.write(`100${mode.toString(8)} `, 100, 7, `utf-8`); // File mode (octal) followed by a space
header.write(`0001750 `, 108, 8, `utf-8`); // Owner's numeric user ID (octal) followed by a space
header.write(`0001750 `, 116, 8, `utf-8`); // Group's numeric user ID (octal) followed by a space
header.write(`${contentBuffer.length.toString(8)} `, 124, 12, `utf-8`); // File size in bytes (octal) followed by a space
header.write(
`${Math.floor(new Date(2000, 1, 1) / 1000).toString(8)} `,
136,
12,
`utf-8`
); // Last modification time in numeric Unix tim
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!