简体   繁体   English

如何在node.js中更新量角器npm模块?

[英]How can I update the protractor npm module in node.js?

I am using Visual Studio 2013 Node.js Tools for Visual Studio. 我正在使用Visual Studio 2013的Visual Studio 2013 Node.js工具。

I would like to update protractor to this: 我想将量角器更新为:

https://www.npmjs.org/package/protractor

Under npm in Visual Studio I see it shows I have the protractor@0.24.2 module. 在Visual Studio中的npm下,我看到它显示我具有protractor@0.24.2模块。 When I right click on this and select 当我右键单击并选择

update npm module

It goes to 它去

https://registry.npmjs.org/protractor

When I enter that in my URL it shows on the the first line 1.0.0-rc2 as the latest version: 当我在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":

In the output window it shows the update: 在输出窗口中显示更新:

====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====

What I would like to know is if the first line shows 1.0.0-rc2 as the latest version then why does it still show protractor 0.24.2 as the one that it downloaded after the update? 我想知道的是,如果第一行显示1.0.0-rc2为最新版本,那么为什么它仍将量角器0.24.2显示为更新后下载的量角器?

The "npm update" command doesn't actually upgrade packages unconditionally. 实际上,“ npm update”命令不会无条件地升级软件包。 It simply upgrades packages to the maximum allowed semver as noted in the package.json file for your dependencies and their sub dependencies. 只需将package.json文件中指出的依赖项及其子依赖项升级到允许的最大存储数量即可。 To actually upgrade to a newer version you have two options: 要实际升级到较新的版本,您有两个选择:

  1. Use "npm install" and specify the version to install. 使用“ npm install”并指定要安装的版本。 You can use the "latest" tag to specify the latest version without having to look it up. 您可以使用“最新”标签来指定最新版本,而不必查找它。 Use the "--save" flag to have npm edit your package.json file and update to the new version. 使用“ --save”标志让npm编辑您的package.json文件并更新到新版本。

    npm install protractor@latest --save npm install protractor @ latest-保存

  2. Edit the package.json and find the line with "protractor": "0.24.2" and change the version to "1.0.0-rc2" (or whichever version you want). 编辑package.json并找到带有“量角器”的行:“ 0.24.2”,并将版本更改为“ 1.0.0-rc2”(或所需的任何版本)。 Then you can run "npm update" or "npm install" after you have changed and saved the file. 然后,您可以在更改并保存文件后运行“ npm update”或“ npm install”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM