Skip to content

Created noThrow Wrapper for which(), Fixed Arch Map for MSVC#60

Open
diefbell-grabcad wants to merge 9 commits intoEmbeddedEnterprises:masterfrom
diefbell-grabcad:fix/error-not-found-ninja
Open

Created noThrow Wrapper for which(), Fixed Arch Map for MSVC#60
diefbell-grabcad wants to merge 9 commits intoEmbeddedEnterprises:masterfrom
diefbell-grabcad:fix/error-not-found-ninja

Conversation

@diefbell-grabcad
Copy link
Copy Markdown
Contributor

@diefbell-grabcad diefbell-grabcad commented May 28, 2025

When trying to build ZeroMQ.js, I got the error [ERROR cmake-ts] Error: not found: ninja. It seems that this is caused by the nothrow option not being respected here

const ninja = await which("ninja", { nothrow: true })
.

There was some discussion regarding this on the node-which repo, seems the issue is fixed in v3+: npm/node-which#80. However this would require bumping the required Node version.

Instead, I've just created a whichNoThrow function to handle catching and returning null.

There was also an issue in argumentBuilder.ts where cmakeArchMap.win32.x64 was mapping incorrectly to "AMD64", but MSVC expects "x64". I'm not sure though if this breaks other Windows build tools... Can check with CI?

Please also add into ZeroMQ after merge ^_^

Comment thread package.json
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnpm add which@3.0.1 decided it needed to reformat the entire file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which then made linting fail 🤦

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. I can fix that

Copy link
Copy Markdown
Collaborator

@aminya aminya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change. However, since cmake-ts is a build tool that can be used on older Nodejs to build binaries, we want to keep the code compatible with old versions. Does this update break compatibility?

We can create our own which nothrow, if that's the only reason for the bump. Alternatively, we can add polyfils to maintain compatibility.

@diefbell-grabcad diefbell-grabcad changed the title Bumped version of which, bumped cmake-ts's version Created noThrow Wrapper for which(), Fixed Arch Map for MSVC Apr 2, 2026
Comment thread src/argumentBuilder.ts
Comment on lines -160 to +162
arm64: "arm64",
x64: "AMD64",
ia32: "X86",
arm64: "ARM64",
x64: "x64",
ia32: "Win32",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to change this? I tested it when I created this to make sure it works.

@diefbell-grabcad
Copy link
Copy Markdown
Contributor Author

@aminya One year later, I've made the change, as requested :')

@aminya
Copy link
Copy Markdown
Collaborator

aminya commented Apr 2, 2026

@aminya One year later, I've made the change, as requested :')

I completely forgot about this. Haha. It's great you made the changes. I'll test in the coming days.

@diefbell-grabcad diefbell-grabcad requested a review from aminya April 16, 2026 10:58
@diefbell-grabcad
Copy link
Copy Markdown
Contributor Author

I was thinking that we perhaps want to add an MSVC test to the workflows, such as with https://github.com/ilammy/msvc-dev-cmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants