Эх сурвалжийг харах

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>
Amr Bashir 2 жил өмнө
parent
commit
1c8229fbe2

+ 5 - 0
.changes/clijs-node-version.md

@@ -0,0 +1,5 @@
+---
+'cli.js': patch
+---
+
+Fix crash when nodejs binary has the version in its name, for example `node-18`

+ 1 - 1
tooling/cli/node/tauri.js

@@ -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