Skip to content

Commit

Permalink
Update Install-NodeJS.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
RaviAkshintala authored Nov 12, 2024
1 parent c42c634 commit 597e19a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions images/windows/scripts/build/Install-NodeJS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
## Must run after python is configured
################################################################################


$prefixPath = 'C:\npm\prefix'
$cachePath = 'C:\npm\cache'

Expand All @@ -12,9 +13,12 @@ New-Item -Path $cachePath -Force -ItemType Directory


$defaultVersion = (Get-ToolsetContent).node.default
# Install default Node.js using the new method
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/tj/n/master/bin/n" -OutFile "$env:USERPROFILE\n"
& "$env:USERPROFILE\n" $defaultVersion
\
$gitBashPath = "C:\Program Files\Git\bin\bash.exe" # Path to Git Bash executable
$command = "& `"$gitBashPath`" --login -i -c ""bash ~/n $defaultVersion""" # Running 'n' script with specified version
Invoke-Expression $command


Add-MachinePathItem $prefixPath
Update-Environment
Expand All @@ -25,9 +29,11 @@ $env:npm_config_prefix = $prefixPath
npm config set cache $cachePath --global
npm config set registry https://registry.npmjs.org/


$globalNpmPackages = (Get-ToolsetContent).npm.global_packages
$globalNpmPackages | ForEach-Object {
npm install -g $_.name
}

Invoke-PesterTests -TestFile "Node"

0 comments on commit 597e19a

Please sign in to comment.