Fix : widows giea 1
This commit is contained in:
@@ -69,7 +69,13 @@ Write-Host ''
|
||||
$nodeMajor = 0
|
||||
$nodeCmd = Get-Command node -ErrorAction SilentlyContinue
|
||||
if ($nodeCmd) {
|
||||
$nodeMajor = [int]((& node -p 'process.versions.node.split(".")[0]') 2>$null)
|
||||
# On lit `node --version` plutôt que d'évaluer une expression JavaScript.
|
||||
# PowerShell 5.1 perd les guillemets doubles imbriqués quand il passe un
|
||||
# argument à un exécutable natif : `node -p 'x.split(".")[0]'` arrive côté
|
||||
# Node comme `x.split(.)[0]`, qui lève une SyntaxError. Le majeur valait
|
||||
# alors 0 et le script réinstallait Node sur une machine déjà équipée.
|
||||
$nodeRaw = (& node --version 2>$null)
|
||||
if ($nodeRaw -match '^v(\d+)\.') { $nodeMajor = [int]$Matches[1] }
|
||||
}
|
||||
|
||||
if ($nodeMajor -lt 22) {
|
||||
|
||||
Reference in New Issue
Block a user