Skip to content

Instantly share code, notes, and snippets.

@zleight1
Last active February 10, 2021 20:51
Show Gist options
  • Save zleight1/292d2dc1cf78c8b49c0d8e66a6a37b2e to your computer and use it in GitHub Desktop.
Save zleight1/292d2dc1cf78c8b49c0d8e66a6a37b2e to your computer and use it in GitHub Desktop.
Script to download and fix npm windows-build-tools C++ deps
$TempDir = "C:\temp\windows-build-tools"
If(!(test-path $TempDir))
{
New-Item -ItemType Directory -Force -Path $TempDir
}
$client = new-object System.Net.WebClient;
$client.DownloadFile("https://aka.ms/vs/16/release/vs_buildtools.exe","$TempDir\vs_buildtools.exe");
cd "$TempDir";
.\vs_buildtools.exe --passive --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --locale en-US --noUpdateInstaller | Out-Null;
npm i -g --production windows-build-tools;
npm i -g node-gyp;
npm i node-expat;
cd C:\;
Get-ChildItem -Path $TempDir -Recurse | Remove-Item -force -Recurse -ErrorAction SilentlyContinue
Remove-Item $TempDir -Force
@zleight1
Copy link
Author

zleight1 commented Feb 10, 2021

iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/zleight1/292d2dc1cf78c8b49c0d8e66a6a37b2e/raw/fix-windows-build-tools.ps1'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment