Visual Studio Online MSBuild fails to install bower install

I have a simple web project with bower.json, package.json and Gruntfile.js I modified my .csproj file to add targets to run

  • npm install
  • bower installation
  • grunt build

npm install works fine, but bower installation does not start. That's all I have from magazines

node_modules\.bin\bower cache clean node_modules\.bin\bower install C:\a\src\TestProj\TestProj\TestProj.csproj(137,5): error MSB3073: The command ".\node_modules\.bin\bower install" exited with code 1. 

Here is what I do in csproj definitio

 <Target Name="BeforeBuild"> <Exec Command="npm cache clean" /> <Exec Command="npm install" /> <Exec Command="node_modules\.bin\bower cache clean" /> <Exec Command="node_modules\.bin\bower install" /> </Target> 

Here is my bower.json

  "name": "TestProj", "version": "0.0.1", "description": "", "main": "index.html", "moduleType": [ "amd" ], "authors": [ "Sujesh Arukil" ], "license": "MIT", "private": true, "ignore": [ "**/.*", "node_modules", "bower_components", "test", "tests" ], "devDependencies": { "knockoutjs": "~3.2.0" } 
+6
source share
5 answers

bower installation failed because the two modules I used depended on different versions of jQuery and could not find permission and wanted to enter the user. Fixed by providing permission section.

+1
source

I managed to break through this problem by commenting on the bower installation command in the .csproj file

  <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> <!--<Exec Command="bower install" />--> <Exec Command="dotnet bundle" /> </Target> 
+2
source

First enable diagnostic logging.

Then change the target:

 <Target Name="BeforeBuild"> <Exec Command="npm cache clean" /> <Exec Command="npm install" /> <Message Condition="!EXISTS('node_modules\.bin\bower')" Text="bower does not exist" Importance="high" /> <Exec Command="node_modules\.bin\bower cache clean" /> <Exec Command="node_modules\.bin\bower install" /> </Target> 
0
source

You should be able to download an additional MSBuild log file, which may contain more details. If you look at a previously failed build, then click on the View Log link at the top and then look at the details and you will see a link to the log file a couple of lines after your error message. Build error

If I had to guess the top of my head, although you get this error because git is not available.

0
source

Worked for me by deleting the code below in the .csproj file.

 <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> <Exec Command="bower install" /> <Exec Command="dotnet bundle" /> 

However, this caused a couple of typescript problems with duplicate method names, add the code below to the tsconfig.json file

"exclude": [ "obj" ]

0
source

Source: https://habr.com/ru/post/974169/


All Articles