ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

javascript – 如何隔离凉亭中的依赖关系

2019-07-08 17:35:24  阅读:201  来源: 互联网

标签:jquery javascript angularjs bower bower-install


我记得读到某个地方,在凉亭中,您可以将软件包作为子树安装,这意味着一个项目可以使用同一个库的多个版本..每个版本的库都充当了需要不同版本的其他库的依赖项.

作为一个例子..假设我正在开发一个使用angular-google-maps和ui-slider的项目..
angular-google-maps至少要求角度为1.2.18,而ui-slider需要角度1.0.8
`
我希望得到这样的东西(即凉亭列表的输出):

├── angular#1.2.18
├─┬ angular-google-maps#1.1.2 extraneous (latest is 1.1.6)
│ ├── angular#1.2.18
│ └── ..
├─┬ angular-ui-slider#0.0.2
│ ├── angular#1.0.8
│ ├── ..

相反,当我尝试在已经使用角度为1.2.18的现有项目上安装ui-slider时,我得到以下提示:

Unable to find a suitable version for angular, please choose one:
    1) angular#~1.0.x which resolved to 1.0.8 and is required by angular-ui-slider#0.0.2 
    2) angular#1.2.5 which resolved to 1.2.5 and is required by angular-sanitize#1.2.5 
    3) angular#1.2.18 which resolved to 1.2.18 and is required by angular-brunch-seed 
    4) angular#>=1 which resolved to 1.2.19 and is required by angular-bootstrap#0.5.0 
    5) angular#~1.2.0 which resolved to 1.2.19 and is required by angular-masonry#0.8.1 
    6) angular#1.2.x which resolved to 1.2.19 and is required by angular-google-maps#1.1.2 
    7) angular#1.2.19 which resolved to 1.2.19 and is required by angular-animate#1.2.19 
    8) angular#* which resolved to 1.2.19 and is required by restangular#1.4.0

Prefix the choice with ! to persist it to bower.json

我自然会选择一个获得1.0.8:

[?] Answer: 1
bower angular#~1.0.x                    install angular#1.0.8
bower angular-ui-slider#~0.0.2          install angular-ui-slider#0.0.2

但是,当我运行凉亭列表时,我得到:

├── angular#1.0.8 incompatible with 1.2.18 (1.2.18 available, latest is 1.3.0-build.2867+sha.f07af61)
├─┬ angular-animate#1.2.19 (latest is 1.3.0-build.2867+sha.f07af61)
│ └── angular#1.0.8 incompatible with 1.2.19 (1.2.19 available, latest is 1.3.0-build.2867+sha.f07af61)
├─┬ angular-bootstrap#0.5.0 (latest is 0.11.0)
│ └── angular#1.0.8 (1.3.0-build.2867+sha.f07af61 available)
├─┬ angular-cookies#1.2.5 (latest is 1.3.0-build.2867+sha.f07af61)
│ └── angular#1.0.8 incompatible with 1.2.5 (1.2.5 available, latest is 1.3.0-build.2867+sha.f07af61)
├─┬ angular-google-maps#1.1.2 extraneous (latest is 1.1.6)
│ ├── angular#1.0.8 incompatible with 1.2.x (1.2.19 available, latest is 1.3.0-
├─┬ angular-ui-slider#0.0.2
│ ├── angular#1.0.8 (latest is 1.3.0-build.2867+sha.f07af61)
..

问题:为什么凉亭使角度1.0.8成为默认角度和用于我所有其他库的一个…而不是保持角度1.2.18并且只使用角度1.0.8用于角度ui滑块?

解决方法:

您不能同时运行两个版本的角度运行.所以bower要求您选择要安装的那个.在这里,您选择1,因此无论兼容性如何,它都会为您的所有包安装角度1.0.8依赖性.
这是设计意图的行为.

标签:jquery,javascript,angularjs,bower,bower-install
来源: https://codeday.me/bug/20190708/1404424.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有