- try to log the install error

This commit is contained in:
denihs
2024-10-21 17:08:52 -04:00
parent 1ca4a25392
commit e06ffeebf9

View File

@@ -185,14 +185,16 @@ Function Add-NodeAndNpm {
# Let's install the npm version we really want.
Write-Host "Installing npm@${NPM_VERSION}..." -ForegroundColor Magenta
& "$tempNpmCmd" install --prefix="$dirLib" --no-bin-links --save `
--cache="$dirNpmCache" --nodedir="$dirTempNode" npm@${NPM_VERSION} |
Write-Debug
$npmOutput = & "$tempNpmCmd" install --prefix="$dirLib" --no-bin-links --save `
--cache="$dirNpmCache" --nodedir="$dirTempNode" npm@${NPM_VERSION} 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "Error installing npm@${NPM_VERSION}:" -ForegroundColor Red
Write-Host $npmOutput -ForegroundColor Red
throw "Couldn't install npm@${NPM_VERSION}."
}
# After finishing up with our Node, let's put it in its final home
# and abandon this local npm directory.