Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM Update - Forcing Package Upgrades (Ignoring SemVer)

Is there a reasonable way to force an update on a node package?

It's great that we are protected from aggressive package development, but it seems like most package versions get saved as exact (i.e. the invisible =, rather than with an inequality or ^ or ~) version numbers, so upgrading even to a patch version seems laborious.

I'm actually not getting npm update to work for me at all.

For example, I have, in my package.json, a package (let's say dependencypackage) listed as such: "dependencypackage":"^0.5.1", and the latest version of dependencypackage on www.npmjs.com is 0.7.1.

Unless I'm mistaken, according to the doc for update, I should be able to run npm update --save dependencypackage to update the package both in the ./node_modules directory, and in the package.json listing.

Unfortunately, this is not working for me. I get no information or output from the command.

Additional info:

  • node version: 6.11.2
  • npm version: 5.3.0

Example of an unreasonable solution:

  • remove and reinstall each package by hand
like image 332
R. Glenn Avatar asked Aug 23 '17 00:08

R. Glenn


People also ask

Does npm use SemVer?

The Node Package Manager (npm) ecosystem uses Semantic Versioning, or SemVer, as the standard for version numbers. By default, when installing an npm package without specifying a version, npm installs the latest version published to the NPM registry.

How do I automatically update npm packages?

Run npm update to automatically update my packages to the latest versions From docs: > This command will update all the packages listed to the latest version (specified by the tag config), respecting the semver constraints of both your package and its dependencies (if they also require the same package).

What is SemVer in npm?

SemVer stands for Semantic Versioning. NPM stands for Node Package Manager. Because there can be different versions of a module that is installable, and the need to install various versions can differ, there exists what we call SemVer. NPM is used to install packages or modules in NodeJS.


1 Answers

In order to accomplish that I use npm-check

npm i -g npm-check
npm-check -u

And, if you have outdated dependencies, you'll get something like this enter image description here

You can then sell the ones you want to upgrade and hit enter. It works like a charm.

like image 73
Mestre San Avatar answered Oct 20 '22 06:10

Mestre San