What does 'npm outdated --depth=0 ' mean to do as ask action when seeing differences? - npm

When running the command npm outdated --depth=0 I see the following:
Package Current Wanted Latest Location
cordova 5.4.1 5.4.1 6.0.0 cordova
grunt-angular-templates 0.5.9 0.5.9 1.0.3 grunt-angular-templates
grunt-autoprefixer 0.4.2 0.4.2 3.0.4 grunt-autoprefixer
grunt-bump 0.3.4 0.3.4 0.7.0 grunt-bump
...
What does those differences between 'Current', 'Wanted' and 'Latest' mean to me? Respectively what am I supposed to do in case?

Current: Current version of the packages installed.
Wanted: The maximum version of the package that satisfies the semver range specified in package.json. If there's no available semver range (i.e. you're running npm outdated --global, or the package isn't included in package.json), then wanted shows the currently-installed version.
Latest: The version of the package tagged as latest in the registry. Running npm publish with no special configuration will publish the package with a dist-tag of latest. This may or may not be the maximum version of the package, or the most-recently published version of the package, depending on how the package's developer manages the latest dist-tag.
Reference: https://docs.npmjs.com/cli/outdated

Related

Can't update to newer version of AWS-CDK

I have aws-cdk version 2.44.0.
I've got notified (after running cdk diff) that there is a newer version, 2.47.0, and I should run npm install -g aws-cdk to upgrade to this version. I ran this command successfully with sudo (since without it I get errors) and got the following output:
changed 1 package, and audited 2 packages in 2s
found 0 vulnerabilities
but after check with cdk --version I found that the version is still 2.44.0.
additional information:
Ubuntu 20.04.4 LTS
Node.js v16.17
npm version: 8.19.2
So, how to update aws-cdk successfuly?
It turned out that this old version was installed using older version of npm which installed it in usr/local/bin, while the newer version of npm installed the latest version of cdk in usr/bin. After locally uninstalled the older version and running again which cdk it finally recognized the newer version in usr/bin.

Install elm package with a specifying version?

I am doing an Elm's tutorial. By that, the package elm/http is version 1.0.0. But when I installed, the current version is 2.0.0. And I don't how to install the package with a specifying version(here is elm/http 1.0.0).
I tried to modify the version of elm/http package to 1.0.0 in elm.json and then re-install with elm install elm/http but It's not working.
In JavaScript, I use npm i thePackage#1.0.0 to do that.
Many thanks!
In Elm 0.19, elm install <package> just updates your elm.json file, there is no local installation of the packages. So updating the field in elm.json to 1.0.0 should be all that you need to do. elm make will see that and use the right package.

Kata 1.6.2 dependency chain broken

Kata 1.6.2 release page here:
https://github.com/kata-containers/runtime/releases/tag/1.6.2
We are trying to consume the latest stable-1.6 release of kata but are hitting the dependency error below when attempting to install the package.
$ sudo apt install kata-runtime
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
kata-runtime : Depends: kata-linux-container (>= 4.19.34.33-4) but 4.19.28.31-3 is to be installed
E: Unable to correct problems, you have held broken packages.
http://download.opensuse.org/repositories/home:/katacontainers:/releases:/x86_64:/stable-1.6/xUbuntu_16.04/
https://imgur.com/aA8GOe2.jpg
To answer this question. You can download the latest package based on the fixes identified in 1.6.2. In particular, this fix.
You can always download the 1.6.2 package too: kata-static-1.6.2-x86_64.tar.xz.

npm update is not honoring the results of npm outdated

I ran npm outdated on a project - it showed that there were several outdated packages. So I ran npm update - it updated a few packages but not all. If I run npm outdated again it still shows the remaining packages that are outdated:
Package Current Wanted Latest
babel-loader 7.1.1 7.1.1 7.1.2
babel-runtime 6.23.0 6.23.0 6.26.0
chalk 2.0.1 2.0.1 2.1.0
css-loader 0.28.4 0.28.4 0.28.5
eslint 4.2.0 4.2.0 4.5.0
eslint-plugin-react 7.1.0 7.1.0 7.2.1
fs-extra 4.0.0 4.0.0 4.0.1
html-webpack-plugin 2.29.0 2.29.0 2.30.1
material-ui 1.0.0-beta.5 1.0.0-beta.5 0.19.0
postcss-flexbugs-fixes 3.0.0 3.0.0 3.2.0
react-stripe-elements 0.0.2 0.0.2 0.0.7
webpack 3.3.0 3.3.0 3.5.5
webpack-dev-server 2.5.1 2.5.1 2.7.1
webpack-manifest-plugin 1.1.2 1.1.2 1.3.1
If I try to run npm update again, it does nothing!
Why are the two commands telling me different things?
Thanks in advance.
If you run npm update and some of the packages defined in package.json have their version pinned, it will not update. That is why you see three columns when you run npm outdated. The current installed version, the latest version that matches what is defined in your package.json, and finally, the actual latest version.

Use NVM To Install Latest NodeJS For Specific Major Version

I want to install the latest minor/patch version of NodeJS 4 using nvm. I don't just want "latest", because that would be NodeJS 8 or whatever later, potentially breaking-change version is out now.
If it were an npm dependency, I would be able to say nvm install "^4", but that doesn't work. Is there a simple command to do this? If there isn't, is there something I can do on the command line to find the latest version and install it in a one-liner that works on both Windows and Unix-based consoles?
(nvm maintainer here)
If you run nvm --help (make sure you're using the latest version of nvm), you'll see a description of all the things nvm supports. Specifically, nvm does not support semver ranges, however, nvm install 4 or nvm install 4.x will install the latest available version of node 4.
Separately, you can use nvm install --lts=argon (and nvm alias default lts/argon if you want to peg to the LTS line specifically instead of just v4.