‘Exited with code 9009’ publishing .NET Core app to Azure Websites

imageI recently installed a fresh copy of Visual Studio 2017 on a new computer. And I am migrating some code from .NET 4.6 to .NET Core. After some hair pulling over changes in the libraries, it now compiles and runs great.

But when I go to deploy to Azure Websites I get errors that look like this:

The command "bower install" exited with code 9009.


The command "npm install" exited with code 9009.

So what is Bower, and Gulp and why are they interesting in a code migration?

When Visual Studio migrated my application, it helped out by adding some pre-processing commands to the project file.

<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="npm install" />
<Exec Command="bower install" />
<Exec Command="gulp clean" />
<Exec Command="gulp min" />

Are they useful commands?


Bower keeps track of these packages in a manifest file, bower.json. How you use packages is up to you. Bower provides hooks to facilitate using packages in your tools and workflows. Bower is optimized for the front-end.


Gulp is a javascript task runner that lets you automate tasks such as…

  • Bundling and minifying libraries and stylesheets.
  • Refreshing your browser when you save a file.
  • Quickly running unit tests
  • Running code analysis
  • Modified files to an output directory

The fix

Blake Pell’s blog helped me the most with this suggestion:

Install npm and bower globally. Open up a command prompt as administrator and type

npm install -g bower

If that doesn’t work, try these steps:

  1. Install NodeJS & npm from https://docs.npmjs.com/getting-started/installing-node
  2. Update to the latest NPM: npm install npm@latest -g
  3. Install bower globally: npm install -g bower

And I needed to install Gulp:

npm install -g gulp