Skip to content

Commit 1c8229f

Browse files
fix(cli.js): detect node-<version> binary, closes #6427 (#6432)
* fix(cli.js): detect `node-<version>` binary, closes #6427 * use `?` instead of `*` and escape the hyphen Co-authored-by: TurtleIdiot <18502738+TurtleIdiot@users.noreply.github.com> --------- Co-authored-by: TurtleIdiot <18502738+TurtleIdiot@users.noreply.github.com>
1 parent e513b69 commit 1c8229f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changes/clijs-node-version.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'cli.js': patch
3+
---
4+
5+
Fix crash when nodejs binary has the version in its name, for example `node-18`

tooling/cli/node/tauri.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (bin === '@tauri-apps/cli') {
2020
}
2121
// Even if started by a package manager, the binary will be NodeJS.
2222
// Some distribution still use "nodejs" as the binary name.
23-
else if (binStem.match(/(nodejs|node)([1-9]*)*$/g)) {
23+
else if (binStem.match(/(nodejs|node)\-?([1-9]*)*$/g)) {
2424
const managerStem = process.env.npm_execpath
2525
? path.parse(process.env.npm_execpath).name.toLowerCase()
2626
: null

0 commit comments

Comments
 (0)