2015-02-12 26 views
17

我試圖安裝基礎,但它不斷給我的衝突與jQueryECONFLICT無法找到合適版本的jQuery基金會

λ bower install foundation 
bower foundation#x    cached https://github.com/zurb/bower-foundation.git#5.5.1 
bower foundation#x   validate 5.5.1 against https://github.com/zurb/bower-foundation.git#x 
bower foundation#*    cached https://github.com/zurb/bower-foundation.git#5.5.1 
bower foundation#*   validate 5.5.1 against https://github.com/zurb/bower-foundation.git#* 
bower jquery#>= 2.1.0   cached https://github.com/jquery/jquery.git#2.1.3 
bower jquery#>= 2.1.0   validate 2.1.3 against https://github.com/jquery/jquery.git#>= 2.1.0 
bower modernizr#>= 2.7.2  cached https://github.com/Modernizr/Modernizr.git#2.8.3 
bower modernizr#>= 2.7.2  validate 2.8.3 against https://github.com/Modernizr/Modernizr.git#>= 2.7.2 
bower jquery.cookie#~1.4.0  cached https://github.com/carhartl/jquery-cookie.git#1.4.1 
bower jquery.cookie#~1.4.0 validate 1.4.1 against https://github.com/carhartl/jquery-cookie.git#~1.4.0 
bower fastclick#>=0.6.11  cached https://github.com/ftlabs/fastclick.git#1.0.6 
bower fastclick#>=0.6.11  validate 1.0.6 against https://github.com/ftlabs/fastclick.git#>=0.6.11 
bower jquery-placeholder#~2.0.7 cached https://github.com/mathiasbynens/jquery-placeholder.git#2.0.9 
bower jquery-placeholder#~2.0.7   validate 2.0.9 against https://github.com/mathiasbynens/jquery-placeholder.git#~2.0.7 
bower         ECONFLICT Unable to find suitable version for jquery 

我bower.json文件是這樣的

{ 
    "name": "refactor", 
    "private": true, 
    "dependencies": { 
    "jquery": "~1.11.1", 
    "raphael": "1.3.x", 
    "font-awesome": "~4.3.0", 
    "foundation": "x" 
    } 
} 
+0

使用「jquery」:「> = 2.0.0」 – 2015-02-12 04:50:33

+0

我剛剛刪除了JQuery。現在它從基金會獲得,我不知道它是否正確的做法 – 2015-02-12 04:55:43

+0

查看下面的答案,讓我知道它是否工作。謝謝 – 2015-02-12 04:58:02

回答

29

使用resolutionsbower.json

{ 
    "name": "refactor", 
    "private": true, 
    "dependencies": { 
    "jquery": "~1.11.1", 
    "raphael": "1.3.x", 
    "font-awesome": "~4.3.0", 
    "foundation": "x" 
    }, 
    "resolutions": { 
    "jquery": "~1.11.1" 
    } 
} 

這將迫使涼亭使用特定版本的jQuery。先從

+0

非常好!非常感謝你! – 2016-05-14 18:35:53

+0

這對我有用!我從npm調試日誌中獲得的錯誤消息(並且在控制檯中更加隱蔽)指出需要哪種版本的jQuery。這是爲Drupal 8網站提供流浪漢的時候。非常感謝! – 2016-12-29 21:15:26

1

嘗試使用此對於Jquery版本:

"jquery": ">= 2.0.0" 

但是我認爲你只需要Foundation作爲依賴項:

enter image description here

或:

{ 
    "name": "PROJECT_NAME", 
    "dependencies": { 
     "foundation": "~5.4.7" 
    } 
} 

也是在這裏獲得更多的細節:

http://foundation.zurb.com/docs/sass.html

3

最好的辦法是做

bower cache clean 

後,當你做

bower install它會問你

'Unable to find a suitable version for <Your Dependency Name>, please choose one:

,那麼你可以進入!1!2,或任何適合您的需求最好的。

這實際上是將分辨率塊添加到@esbanarango提到的bower.json中,但它只是對您正在做的事情給予更多的控制和理解。