Files
runner-images-temp/images/windows/scripts/build/Install-NodeJS.ps1
T

33 lines
1.1 KiB
PowerShell
Raw Normal View History

################################################################################
## File: Install-NodeJS.ps1
## Desc: Install nodejs-lts and other common node tools.
## Must run after python is configured
################################################################################
$PrefixPath = 'C:\npm\prefix'
$CachePath = 'C:\npm\cache'
New-Item -Path $PrefixPath -Force -ItemType Directory
New-Item -Path $CachePath -Force -ItemType Directory
2021-10-30 14:03:05 +03:00
$defaultVersion = (Get-ToolsetContent).node.default
$versionToInstall = Get-LatestChocoPackageVersion -TargetVersion $defaultVersion -PackageName "nodejs"
2021-11-09 17:18:30 +03:00
Choco-Install -PackageName nodejs -ArgumentList "--version=$versionToInstall"
Add-MachinePathItem $PrefixPath
$env:Path = Get-MachinePath
2020-09-09 10:45:40 -07:00
setx npm_config_prefix $PrefixPath /M
$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
}
2020-09-09 10:45:40 -07:00
Invoke-PesterTests -TestFile "Node"