Skip to content

EINVAL errors when using Node.JS 18.20.4 on Windows 11 #606

Open
@jjhritz89

Description

Due to a security change in Node.js for Windows (CVE-2024-27980) linked here The "gitbook new" action would throw a spawn EINVAL error when attempting to install dependencies.

The fix I had to do, was add shell:true to the installdependencies function as shown here:

function installDependencies(dirPath) {
  return new Promise((resolve6, reject) => {
    const install = (0, import_child_process2.spawn)(/^win/.test(process.platform) ? "npm.cmd" : "npm", ["install"], {
      studio: "inherit",
      shell: true,
      cwd: dirPath
    });
    install.on("close", (code) => {
      if (code !== 0) {
        throw new Error(`npm install exited with code ${code}`);
      }
      resolve6();
    });
  });
}

However, I'm having a similar issue when attempting the "gitbook dev" action, I get a ENOENT issue which seems to be related to the spawn command also.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions