Solution for “npm install existed with error code -1” while publishing .NET Core application to Azure web app

Krishna Kanhaiya
2 min readAug 3, 2019

Lately, I was trying to deploy a default template of .Net core angular web application which is shipped with visual studio and ran into “npm install existed with error code -1” issue. After searching and going through some solutions on stack-overflow, following are the set of steps which resolved the issue for me and I was able to deploy the web application successfully on azure. In this blog we will first try to reproduce the issue and then solve it. If you are already facing this issue you can skip to step 10 under procedure section.

Environment:

  1. Operating System: Windows 10

Prerequisite:

  1. Visual studio 2019

2. Azure subscription

Procedure:

  1. Create a .net core web application using visual studio and select angular as the front end framework

2. Navigate to https://portal.azure.com/ and login with your credential(you need to have an azure subscription for this step)

3. Move back to visual studio and select publish after right clicking on the project file

4. On the publish page Click on New link present below the profile drop down

5. Select Create new and click on create profile

6. Add the details asked in the pop up, app name should be unique

7. Click on Create once all the required fields are filled

8. Click on the Publish button on the publish page

9. You will get and error saying “npm install existed with error code -1”

10. To fix this issue just add the following code block in your angular app’s package.json file

changes in package.json

11. Publish the application again.

This will fix the npm install issue and deploy your .net core application to azure web app.

You can fork https://github.com/krishjan05/netcore-angular-azure as the starting point for your .net core angular application which can be deployed without any error to azure.

--

--