Immutable solution version
npm check and update package if needed
Complete solution
To check if any module in a project is 'old': npm outdated ' outdated ' will check every module defined in file package.json and see if there is a newer version in the NPM registry.
To check if any module in a project is 'old': npm outdated ' outdated ' will check every module defined in file package.json and see if there is a newer version in the NPM registry. For example, say xml2js 0.2.6 (located in folder [nodemodules] 3 in the current project) is outdated, because a newer version exists (0.2.7). You would see: xml2js@0.2.7 nodemodules/xml2js current=0.2.6 To update all dependencies, if you are confident this is desirable: npm update Or, to update a single dependency, such as xml2js : npm update xml2js To update package.json version numbers, append the --save flag: npm update --save
Context: We need to integrate the Karma test runner into TeamCity , and for that, I'd like to give systems engineers a small script (PowerShell or whatever) that would: pick up the desired version number from some configuration file (I guess I can put it as a comment right in the karma.conf.js file) check if the defined version of Karma runner installed in npm's global repository if it's not, or the installed version is older than desired: pick up and install the right version run it:
Evidence
Source: We need to integrate the Karma test runner into TeamCity , and for that, I'd like to give systems engineers a small script (PowerShell or whatever) that would: pick up the desired version number from some configuration file (I guess I can put it as a comment right in the karma.conf.js file) check if the defined version of Karma runner installed in npm's global repository if it's not, or the installed version is older than desired: pick up and install the right version run it:
Verified resolution: To check if any module in a project is 'old': npm outdated ' outdated ' will check every module defined in file package.json and see if there is a newer version in the NPM registry. For example, say xml2js 0.2.6 (located in folder [nodemodules] 3 in the current project) is outdated, because a newer version exists (0.2.7). You would see: xml2js@0.2.7 nodemodules/xml2js current=0.2.6 To update all dependencies, if you are confident this is desirable: npm update Or, to update a single dependency, such as xml2js : npm update xml2js To update package.json version numbers, append the --save flag: npm update --save
Source URL: https://stackoverflow.com/questions/16525430/npm-check-and-update-package-if-needed
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_9ziR2VMlCRFDat6Qr5uTiw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">npm check and update package if needed <span>— Vectle</span></a>