Skip to content

Commit

Permalink
fix(cli.js): detect node-<version> binary, closes #6427 (#6432)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
amrbashir and TurtleIdiot committed Mar 16, 2023
1 parent e513b69 commit 1c8229f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/clijs-node-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'cli.js': patch
---

Fix crash when nodejs binary has the version in its name, for example `node-18`
2 changes: 1 addition & 1 deletion tooling/cli/node/tauri.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (bin === '@tauri-apps/cli') {
}
// Even if started by a package manager, the binary will be NodeJS.
// Some distribution still use "nodejs" as the binary name.
else if (binStem.match(/(nodejs|node)([1-9]*)*$/g)) {
else if (binStem.match(/(nodejs|node)\-?([1-9]*)*$/g)) {
const managerStem = process.env.npm_execpath
? path.parse(process.env.npm_execpath).name.toLowerCase()
: null
Expand Down

0 comments on commit 1c8229f

Please sign in to comment.