Sdk: No executable found matching command "bower"

Created on 31 May 2016  路  9Comments  路  Source: dotnet/sdk

Steps to reproduce

Create new ASP.NET Core Web Application. Try to publish from cmd/powershel with "dotnet publish". After this i got such error: No executable found matching command "bower".

How can i fix this?

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-002900)

Product Information:
Version: 1.0.0-preview2-002900
Commit SHA-1 hash: f4ceb1f213

Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64

Most helpful comment

@emrahtokalak i solved the problem.
need to install bower and gulp(if you use it) as a global packages
npm install -g bower
npm install -g gulp

All 9 comments

I have a same issue but publishing with visual studio successfully.

@emrahtokalak i solved the problem.
need to install bower and gulp(if you use it) as a global packages
npm install -g bower
npm install -g gulp

On the new website template for Visual Studio NPM is not included so the solution posted by @GonzRu won't work.

The solution is to add the path to the VS web tools to the PATH environment variable. Run this in package manager:

$env:path = $env:path + ";C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External"

dotnet build should run fine now.

And how to get bower and gulp on Win Server environment without VS installed?
Should I install nodejs manually and then get both packeages as @GonzRu suggested?

I can't answer @valamelkor's question, but as an addendum to @ahumeniy's comment:

[Environment]::SetEnvironmentVariable("Path", $env:path + ";C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External", [EnvironmentVariableTarget]::Machine)

Will permanently add the path to the environment variable, instead of temporarily.

@valamelkor I feel your pain. I am trying to get dotnet publish to work on a TeamCity build server. The problem with @GonzRu solution is that npm installs bower to your personal AppData directory, which is a terrible idea for a build server. Try this instead on your build server box (and agents!):
1) mkdir c:\npm
2) npm install bower -g --prefix c:\npm
3) add c:npm to your PATH variable
4) reboot

You may want to install gulp while you are at it.

Installing the latest version of nodejs (via msi from their official site) solved the problem for me. Installing bower and gulp globally without updating to latest nodejs version didn't worked for some reason

@borislavml Which node version exactly. Also did you need to install bower and gulp globally on the build server?

node version is 6.9.5 I don't have a build server I'm just playing with .net core on my dev machine(so yes I'm building only locally). I also did what @valamelkor sugested - installing bower and grunt globally with the prefix pointing to which directory I want it installed(not the default user AppData) and adding it to the PATH so that windows can pick it from there when executing build scripts

Was this page helpful?
0 / 5 - 0 ratings