TroubleChute Logo
NODE.JS

Fix 'failed with exit code: 1'


Published: Aug 31, 2022
Last Edit: Sep 5, 2022
Node.js Errors
136 Words, 1 Minute.

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”, 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):

  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 the installation should be okay with everything, and everything should be working.

Below is a picture of the solution after it’s complete.

TCNO TechNobo / TroubleChute © Wesley Pyburn (TechNobo / TroubleChute)