title: Release of ASP.NET core App: The command "npm install" exited with code 9009
body: <p>I have a ASP.NET Core solution with a React frontend. I now have a problem I cannot release the code using the normal release window inside Visual Studio. I publish to a web app inside Azure web apps, and it works perfectly for all my other solutions built the same way.</p>
  
  <p>The code works perfectly locally, and I can run <code>npm install</code> locally without problems. </p>
  
  <p>The error obviously comes from some file not found, when publishing. In my project file I have been debugging and found out this is the challenge:</p>
  
  <pre><code> &lt;Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish"&gt;
      &lt;!-- As part of publishing, ensure the JS resources are freshly built in production mode --&gt;
      &lt;Exec Command="npm install" /&gt;
      &lt;Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" /&gt;
      &lt;Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" /&gt;
  
      &lt;!-- Include the newly-built files in the publish output --&gt;
      &lt;ItemGroup&gt;
        &lt;DistFiles Include="wwwroot\dist\**" /&gt;
        &lt;ResolvedFileToPublish Include="@(DistFiles-&gt;'%(FullPath)')" Exclude="@(ResolvedFileToPublish)"&gt;
          &lt;RelativePath&gt;%(DistFiles.Identity)&lt;/RelativePath&gt;
          &lt;CopyToPublishDirectory&gt;PreserveNewest&lt;/CopyToPublishDirectory&gt;
        &lt;/ResolvedFileToPublish&gt;
      &lt;/ItemGroup&gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p><strong>Error in Visual Studio</strong>:</p>
  
  <pre><code>Severity    Code    Description Project File    Line    Suppression State
  Error       The command "npm install" exited with code 9009.    Likvido.CreditRisk  C:\Users\MYNAME\Documents\Github\Likvido.CreditRisk\Likvido.CreditRisk\Likvido.CreditRisk\Likvido.CreditRisk.csproj 75  
  </code></pre>
  
  <p>If I comment out the first three lines (<code>npm install</code> and the two webpacks), I can publish the solution but without working JavaScript obviously.</p>
  
  <p>Any idea how to solve this? And at least, how to debug it better?</p>
  
  <p><strong>Visual error in Visual Studio</strong>:</p>
  
  <p><a href="https://i.stack.imgur.com/EEVuC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EEVuC.png" alt="enter image description here"></a></p>
  
  <p><strong>The log file refered in the GUI:</strong> </p>
  
  <pre><code>09/04/2018 11.07.03
  System.AggregateException: One or more errors occurred. ---&gt; System.Exception: Publish failed due to build errors. Check the error list for more details.
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
     at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
     at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.&lt;&gt;c__DisplayClass40_0.&lt;PublishAsync&gt;b__2()
     at System.Threading.Tasks.Task`1.InnerInvoke()
     at System.Threading.Tasks.Task.Execute()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.&lt;RunPublishTaskAsync&gt;d__88.MoveNext()
  ---&gt; (Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.&lt;---
  
  ===================
  </code></pre>