2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
2023-11-16 11:20:11 +01:00
|
|
|
## File: Install-NodeJS.ps1
|
2019-12-13 09:48:00 -05:00
|
|
|
## 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
|
2021-11-11 13:13:07 +03:00
|
|
|
$versionToInstall = Get-LatestChocoPackageVersion -TargetVersion $defaultVersion -PackageName "nodejs"
|
2021-11-09 17:18:30 +03:00
|
|
|
|
|
|
|
|
Choco-Install -PackageName nodejs -ArgumentList "--version=$versionToInstall"
|
2019-12-13 09:48:00 -05:00
|
|
|
|
|
|
|
|
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
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2021-01-15 00:27:02 +08:00
|
|
|
npm config set cache $CachePath --global
|
2021-06-04 17:03:52 +05:30
|
|
|
npm config set registry https://registry.npmjs.org/
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2021-08-01 15:10:59 +03:00
|
|
|
$globalNpmPackages = (Get-ToolsetContent).npm.global_packages
|
|
|
|
|
$globalNpmPackages | ForEach-Object {
|
|
|
|
|
npm install -g $_.name
|
|
|
|
|
}
|
2020-07-17 15:29:03 +07:00
|
|
|
|
2020-09-09 10:45:40 -07:00
|
|
|
Invoke-PesterTests -TestFile "Node"
|