Graeck
Graeck

Reputation: 1356

Foundation5 causing error on grunt/bower build

When building my project using Grunt and bower, Foundation seems to be causing an error. You can see it downloading packages, etc, then it quits with:

Fatal error: Unable to find suitable version for jquery

Here's my bower.json:

{
  "name": "MyProject",
  "version": "1",
  "dependencies": {
    "cytoscape": "2.2.7",
    "datatables": "1.9.4",
    "font-awesome": "4.0.3",
    "foundation": "5.2.2",
    "jquery-legacy": "jquery#1.11.0",
    "kineticjs": "5.1.0",
    "nouislider": "6.2.0",
    "rem-unit-polyfill": "1.2.4",
    "respond": ">=1.4.2"
  }
}

I've tried removing each dependency from the bower.json above, one by one, and re-run my grunt file (which includes a trigger for bower install) each time. I get that error until I remove the Foundation line - then everything works ok (well, until Grunt looks for foundation files).

I've looked in Foundation's bower.json and its dependencies, but nothing "seems" amiss.

I attempted to add a resolution to my bower.json:

  ...,
  "resolutions": {
    "jquery": "1.11.0"
  }
}

But that didn't help. (though I may be using that incorrectly?)

If I try bower install direct from the command line I get this:

> Unable to find a suitable version for jquery, please choose one:
>     1) jquery#~1.8.0 which resolved to 1.8.3+1 and has datatables#1.9.4 as dependants
>     2) jquery#>= 2.1.0 which resolved to 2.1.1 and has foundation#5.2.2 as dependants
>     3) jquery#>=1.2 which resolved to 2.1.1 and has jquery.cookie#1.4.1 as dependants
>     4) jquery#>= 1.7.0 which resolved to 2.1.1 and has nouislider#6.2.0 as dependants
> 
> Prefix the choice with ! to persist it to bower.json
> 
> [?] Answer:

I can pick a version there, and it seems to work. But I need this to work within the build script.

Upvotes: 0

Views: 345

Answers (1)

Ahmad Alfy
Ahmad Alfy

Reputation: 13371

Try changing jQuery to be:

"jquery": "~1.11.0"

EDIT

According to Foundation's bower.json, it states that it requires jQuery >= 2.1

{
  "name": "foundation",
  "version": "5.2.2",
  "main": [
    "css/foundation.css",
    "js/foundation.js"
  ],
  "dependencies": {
    "jquery": ">= 2.1.0",
    "modernizr": ">= 2.7.2",
    "fastclick": ">=0.6.11",
    "jquery.cookie": "~1.4.0",
    "jquery-placeholder": "~2.0.7"
  },
  "devDependencies": {
    "jquery.autocomplete": "devbridge/jQuery-Autocomplete#1.2.9",
    "lodash": "~2.4.1"
  },
  "private": true
}

There is a conflict between the 2 version then. Did you change that?

Upvotes: 1

Related Questions