Bower loading devDependencies in production?

Short version

My project requires angular -leaflet, and angular -leaflet has a long list of devDependencies , including jQuery 2. I don’t want jQuery 2 - I want jQuery 1.x. How can I make bower ignore devDependencies angular -leaflet and let me use jQuery 1?

Long version

I am using the gazebo 1.2.8. Here is the minimal bower.json that reproduces the problem for me:

{ "name": "bower-test", "dependencies": { "jquery": "1.x", "angular": "1.2.x", "angular-leaflet": "0.7.x" } } 

Running bower install results in the following error:

 Unable to find a suitable version for jquery, please choose one: 1) jquery#1.x which resolved to 1.11.0 and has bower-test as dependants 2) jquery#2.1.0 which resolved to 2.1.0 and has angular-leaflet#0.7.5 as dependants 3) jquery#>= 1.9.0 which resolved to 2.1.0 and has bootstrap#3.0.3 as dependants 

At least I expected bower install --production ignore devDependencies in angular -leaflet. But here is the result (identical above):

 Unable to find a suitable version for jquery, please choose one: 1) jquery#1.x which resolved to 1.11.0 and has bower-test as dependants 2) jquery#2.1.0 which resolved to 2.1.0 and has angular-leaflet#0.7.5 as dependants 3) jquery#>= 1.9.0 which resolved to 2.1.0 and has bootstrap#3.0.3 as dependants 

Why don't you ignore the devDependencies angular-leaflet? Is there any way to do this?

+8
javascript angularjs bower leaflet
source share
1 answer

I think the solution you are looking for is the resolutions bower.json section, although the reason why the devDependencies your dependencies even being analyzed is not clear to me.

 { "name": "bower-test", "dependencies": { "jquery": "1.x", "angular": "1.2.x", "angular-leaflet": "0.7.x" }, "resolutions": { "jquery": "1.x" } } 

Perhaps this is a slight difference from npm , with bower install xyz devDependencies on devDependencies if the -p or --production option is not specified, but even if it is specified, it does not seem to go to dependencies - this may be a mistake.

UPDATE: The problem seems to be related to this particular package / installation using angular-leaflet . Other components do not have this problem. For example, bower install webmaker-analytics simply retrieves webmaker-analytics , not qunit , although it was specified in this devDependencies package.

+4
source share

All Articles