sdk icon indicating copy to clipboard operation
sdk copied to clipboard

No executable found matching command "bower"

Open GonzRu opened this issue 10 years ago • 9 comments

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

GonzRu avatar May 31 '16 11:05 GonzRu

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

emrahtokalak avatar May 31 '16 12:05 emrahtokalak

@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

GonzRu avatar Jun 01 '16 13:06 GonzRu

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.

ahumeniy avatar Jul 01 '16 00:07 ahumeniy

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?

valamelkor avatar Jul 22 '16 14:07 valamelkor

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.

pavram avatar Aug 11 '16 04:08 pavram

@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.

redwards510 avatar Aug 11 '16 21:08 redwards510

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 avatar Feb 20 '17 15:02 borislavml

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

dcarr42 avatar Mar 03 '17 19:03 dcarr42

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

borislavml avatar Mar 04 '17 16:03 borislavml