Immutable solution version
npm check and update package if needed
Complete solution
Shows how to fix npm check and update package if needed. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For example, say xml2js 0.2.6 (located in folder [node_modules] 3 in the current project) is outdated, because a newer version exists (0.2.7).
Steps
- 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
When to use
You are seeing this: 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. Use this skill when you run into "npm check and update package if needed".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: xml2js 0.2.6, 0.2.7. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved 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 3 · 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>