2015-02-12 20 views
17

Tôi cố gắng để cài đặt Foundation nhưng xung đột liên tục đem lại cho tôi với JqueryECONFLICT Không thể tìm thấy phiên bản phù hợp cho jquery Foundation

λ 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 

tập tin bower.json của tôi là này

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

sử dụng "jquery": "> = 2.0.0" –

+0

Tôi vừa xóa JQuery. Bây giờ nó nhận được từ Foundation, tôi không biết thực hành đúng của nó hay không –

+0

Kiểm tra câu trả lời của tôi dưới đây, cho tôi biết nếu nó làm việc. cảm ơn –

Trả lời

29

Sử dụng resolutions trong bạn bower.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" 
    } 
} 

Điều này sẽ buộc phải sử dụng phiên bản jQuery cụ thể đó.

+0

Tuyệt vời! Cảm ơn nhiều! –

+0

Điều này phù hợp với tôi! Các thông báo lỗi tôi nhận được từ nhật ký gỡ lỗi npm (và hơi khó hiểu hơn trong giao diện điều khiển) chỉ ra phiên bản nào của jQuery là cần thiết. Điều này đã được trong khi cung cấp vagrant cho một trang web Drupal 8. Cảm ơn rất nhiều! –

1

Hãy thử sử dụng này đối với phiên bản Jquery:

"jquery": ">= 2.0.0" 

Tuy nhiên, tôi nghĩ bạn chỉ cần Foundation là phụ thuộc:

enter image description here

hay:

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

cũng kiểm tra vào đây để biết thêm chi tiết:

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

3

Cách tốt nhất để bắt đầu với là để làm

bower cache clean 

Sau đó khi bạn làm

bower install nó sẽ yêu cầu bạn

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

sau đó bạn có thể nhập !1 hoặc !2, hoặc bất cứ điều gì phù hợp với nhu cầu của bạn là tốt nhất.

Điều này chủ yếu là thêm khối độ phân giải vào bower.json như đã đề cập bởi @esbanarango nhưng nó chỉ cung cấp cho kiểm soát nhiều hơn và sự hiểu biết về những gì bạn đang làm.

Các vấn đề liên quan