Node.js - "failed with exit code: 1"

The issue:

When trying to npm install something on Windows through Administrative PowerShell or CMD, you can sometimes encounter an error with something about "Microsoft.cpp", then this 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):

  1. Open Administrative PowerShell.
  2. Run the command Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
  3. Run the command npm install -g windows-build-tools
  4. Once this is completed (Mine took 527.484 seconds - 8.79 minutes)
  5. Now installing should be fine with everything, and everything should be working.

  6. Below is a picture of the solution, after it's complete.


- Profile
- Donations
- TechNobo
- TechNo Tips

TechNobo's logo