Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am using Visual Studio 2013 Node.js Tools for Visual Studio.

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 [email protected] module. 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:

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
[email protected] node_modules\protractor
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
└── [email protected]

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

like image 812
Samantha J T Star Avatar asked Jul 03 '14 08:07

Samantha J T Star


1 Answers

The "npm update" command doesn't actually upgrade packages unconditionally. It simply upgrades packages to the maximum allowed semver as noted in the package.json file for your dependencies and their sub dependencies. To actually upgrade to a newer version you have two options:

  1. Use "npm install" and specify the version to 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.

    npm install protractor@latest --save

  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). Then you can run "npm update" or "npm install" after you have changed and saved the file.

like image 78
Roman Shtylman Avatar answered Oct 22 '22 20:10

Roman Shtylman