When trying to npm install something on Windows through Administrative PowerShell or CMD, you can sometimes encounter an error with something about “Microsoft.cpp”, which might help solve your issue. I was trying to install the Sleep module into my Node.js program, and it failed with exit code 1, as seen below. The solution was installing Python and Visual Studio Build Tools, with the commands at the bottom of the page.
Steps to solve the issue (Installing Python and Visual Studio Build Tools):
- Open Administrative PowerShell.
- Run the command Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
- Run the command npm install -g windows-build-tools
- Once this is completed (Mine took 527.484 seconds - 8.79 minutes)
- Now the installation should be okay with everything, and everything should be working.
Below is a picture of the solution after it’s complete.