Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Node.js CI build on Windows #1641

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions tools/nodejs_api/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,37 @@ if (process.platform === "darwin") {
}
}

const execArgs = {
cwd: path.join(__dirname, "kuzu-source"),
stdio: "inherit",
};

execArgs.env = process.platform === "win32" ? process.env : env;
if (process.platform === "win32") {
// The `rc` package conflicts with the rc command (resource compiler) on
// Windows. This causes the build to fail. This is a workaround which removes
// all the environment variables added by npm.
const pathEnv = process.env["Path"];
const pathSplit = pathEnv.split(";").filter((path) => {
const pathLower = path.toLowerCase();
return !pathLower.includes("node_modules");
});
env["Path"] = pathSplit.join(";");
console.log(
"The PATH environment variable has been modified to remove any 'node_modules' directories."
);

console.log(env);
for (let key in env) {
if (
key.toLowerCase().includes("node" || key.toLowerCase().includes("npm"))
) {
delete env[key];
}
}
console.log(
"Any environment variables containing 'node' or 'npm' have been removed."
);
}

childProcess.execSync("make nodejs NUM_THREADS=" + THREADS, execArgs);
childProcess.execSync("make nodejs NUM_THREADS=" + THREADS, {
env,
cwd: path.join(__dirname, "kuzu-source"),
stdio: "inherit",
});

// Copy the built files to the package directory
const BUILT_DIR = path.join(
Expand Down
Loading