作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在使用适用于 Visual Studio 的 Visual Studio 2013 Node.js 工具。
我想将 Protractor 更新为:
https://www.npmjs.org/package/protractor
在 Visual Studio 的 npm 下,我看到它显示我有 protractor@0.24.2 模块。当我右键单击它并选择
update npm module
它去
https://registry.npmjs.org/protractor
当我在我的 URL 中输入它时,它在第一行显示 1.0.0-rc2
作为最新版本:
https://registry.npmjs.org/protractor
{"_id":"protractor","_rev":"103-dc957e08fce862ad70c481b4a2327ee6",
"name":"protractor","description":"Webdriver E2E test wrapper for Angular.",
"dist-tags":{"latest":"1.0.0-rc2"},
"versions":{"0.1.0":{"name":"protractor",
"description":"End to End test helpers for Angular.",
"homepage":"https://github.com/juliemr/protractor","keywords":
在输出窗口中显示更新:
====Executing command 'npm update protractor --save'====
npm http GET https://registry.npmjs.org/protractor
npm http 304 https://registry.npmjs.org/protractor
npm http GET https://registry.npmjs.org/selenium-webdriver
npm http GET https://registry.npmjs.org/jasminewd
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/saucelabs
npm http GET https://registry.npmjs.org/adm-zip
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/q
npm http GET https://registry.npmjs.org/source-map-support
npm http 304 https://registry.npmjs.org/selenium-webdriver
npm http 304 https://registry.npmjs.org/jasminewd
npm http 304 https://registry.npmjs.org/saucelabs
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/q
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/adm-zip
npm http 304 https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/source-map-support
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/minimist
npm http GET https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/amdefine
npm http 304 https://registry.npmjs.org/amdefine
protractor@0.24.2 node_modules\protractor
├── jasminewd@1.0.1
├── saucelabs@0.1.1
├── q@1.0.0
├── adm-zip@0.4.4
├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.10)
├── lodash@2.4.1
├── glob@3.2.11 (inherits@2.0.1, minimatch@0.3.0)
├── source-map-support@0.2.7 (source-map@0.1.32)
└── selenium-webdriver@2.42.0
====npm command completed with exit code 0====
我想知道的是,如果第一行显示 1.0.0-rc2
为最新版本,那么为什么它仍然显示 protractor 0.24.2 作为更新后下载的版本?
最佳答案
“npm update”命令实际上不会无条件地升级包。它只是将包升级到 package.json 文件中为您的依赖项及其子依赖项指定的最大允许语义版本。要实际升级到较新的版本,您有两种选择:
使用“npm install”并指定要安装的版本。您可以使用“最新”标签来指定最新版本,而无需查找。使用“--save”标志让 npm 编辑您的 package.json 文件并更新到新版本。
npm install protractor@latest --save
编辑 package.json 并找到包含“protractor”的行:“0.24.2”并将版本更改为“1.0.0-rc2”(或您想要的任何版本)。然后,您可以在更改并保存文件后运行“npm update”或“npm install”。
关于node.js - 如何更新 node.js 中的 Protractor npm 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24549048/
我是一名优秀的程序员,十分优秀!