Diego Malanij
Diego Malanij

Reputation: 86

Visual Studio 2015 - Bower not working

I'm trying to start a new ASP.Net MVC 5 project using the new Web Development features included in VS 2015. So far I wasn't able to include any bower packages through the IDE. I've made some tweaks regarding npm, git and bower to include the proxy configuration.

The strange thing is that using node console to run bower works well Success through Node console

However when you try the equivalent with the VS external tool

"C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\bower.cmd" install angular

it fails Error through VS Bower

This is running behind a corporate NTLM authenticated proxy, which is bypassed with CNTLM. But I don't think has much to do as the Node version of bower works perfectly fine. You can see the configuration

.npmrc

registry=http://registry.npmjs.org/
proxy=http://127.0.0.1:8128
http_proxy=http://127.0.0.1:8128
https_proxy=http://127.0.0.1:8128

.gitconfig

[http]
    proxy = http://127.0.0.1:8128
    sslVerify = false
[https]
    proxy = http://127.0.0.1:8128
[url "http://"]
    insteadOf = git://

.bowerrc

{
  "directory": "library",
  "registry": "http://bower.herokuapp.com",
  "proxy":"http://127.0.0.1:8128/",
  "https-proxy":"http://127.0.0.1:8128/"
}

Any thoughts?


[Edit]

The problem ended up being something about permissions. When running VS 2015 "as administrator" it worked fine. It seems some of the operations when moving files from the temporary download folder to the project folder was being prevented (user profiles are created on a network share in this environment, that's what I believe is causing such a mess).

Upvotes: 4

Views: 3219

Answers (3)

r590
r590

Reputation: 736

Had the same issue, but instead of installing a separate bower, I changed the .bowerrc file in the project root directory to:

{
  "directory": "wwwroot/lib",
  "proxy":"http://127.0.0.1:3128/",
  "https-proxy":"http://127.0.0.1:3128/"
}

Upvotes: 0

Diego Malanij
Diego Malanij

Reputation: 86

As mentioned in the post itself, it ended up being a permissions issue, when running VS 2015 as administrator the problem disappeared.

Upvotes: 2

Michael Braude
Michael Braude

Reputation: 6973

Visual Studio uses a sandboxed version of node / NPM by default for Bower rather than the globally installed version. This means any config you made for the global versions won't apply to VS. You can change this so that Visual Studio uses your globally installed version instead which I can see has no problems getting through your firewall.

To do this, go to Tools -> Options and look for this configuration page:

enter image description here

Add an entry for node:

enter image description here

Make sure you drag it higher in the list so that it's before the Web Tools\External entry (that's where VS installs it's sandboxed versions of Node and NPM).

Hope that does the trick.

Upvotes: 3

Related Questions