npm 7 installed but version 6 is still wanted - npm

I recently updated npm to the latest version (7.1.1) using the following command:
npm i -g npm#7.1.1
It successfully installed npm 7.1.1, but when I check for global outdated packages I get this:
https://i.stack.imgur.com/3JzCS.png
How can I set the wanted version of npm to >7.0 so that I don't get this anymore in the outdated list?
Thank you.

The docs for npm outdated indicate that when running npm outdated --global, the Wanted column "shows the currently-installed version." Since it is not doing that, that would seem to be a bug in npm. Either the Wanted column should display 7.1.1 in your case or else the documentation needs to be updated to reflect the actual behavior. (I've confirmed the same behavior on my own machine, so I don't believe this is a case of user error.) I suggest opening an issue in the npm issue tracker.

Related

NPM outdated shows nothing

I use npm 6.11.3. Now I want to updated the local dev dependencies.
But when I use npm outdated the terminal shows nothing. But I know there are updates available for installed dependencies.
Does anyone know, what I'm doing wrong?

NPM install causes a significant amount of errors in React Native

This is most likely an issue with npm.
I have a react-native project that worked fine until I ran npm install.
Once I did this, I started to receive a significant amount of errors.
To name a couple:
I received this for multiple pods:
The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1
There were also multiple modules that had missing files.
I was able to revert to a previous version of my node_modules, without running npm install, and there were no issues.
However, when I run npm install, the issue persists.
Wondering if anyone else has experienced this and found a solution.
i believe you may have conflicts with the version of npm you used previously. i am getting different results when using npm#5 and npm#6 to install.

VS Code terminal fails to use npm version from nvm

I'm using nvm on my Terminal and successfully installed node 10.2.1, which also installed npm 6.1.0. However, when I go to my VS Code editor, it gives me warnings in the integrated terminal for:
npm WARN npm npm does not support Node.js v10.2.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4,6, 7, 8, 9.
Turns out, it is actually using npm 5.5.1 (npm -v).
I check to see what's up with that and tried to dig further and eventually used: which npm on both integrated terminal and Mac's CLI.
Mac's Terminal shows:
/Users/Aiz/.nvm/versions/node/v10.2.1/bin/npm
VS Code's Terminal shows:
/usr/local/bin/npm. Which is interesting, because if you do which node in this terminal, it results in the appropriate /Users/Aiz/.nvm/versions/node/v10.2.1/bin/node.
I'm not sure how to get my VS Code terminal to point to the appropriate npm install through nvm. Not sure if it helps, but I checked npm get prefix and npm -g bin to find /Users/Aiz/.nvm/versions/node/v10.2.1. The only difference I'm finding is where each terminal is using npm from.
I ended up looking through VS Code issues on GitHub and came across something relevant to NVM and node issues. It fixed my issue since the underlying cause was the same.
Essentially what happened is that I had a global install of node before that I removed prior to using NVM but hadn't removed my global install of npm. This was causing conflicts in VS Code's terminal (not Mac's terminal). In order to fix this, you essentially have to find the symlink for which npm and remove the node_modules and npm associated recursively.
Here's the link you'll need: https://github.com/Microsoft/vscode-docs/blob/master/docs/editor/integrated-terminal.md#why-is-nvm-complaining-about-a-prefix-option-when-the-integrated-terminal-is-launched.
Don't forget to restart your editor after.
Another solution is to implement this. https://medium.com/#kinduff/automatic-version-switch-for-nvm-ff9e00ae67f3
Basically, nvm will check for a .nvmrc and switch or default each time you go to a new directory in shell.
It does have a dependency on zsh.
The fix for me on Ubuntu:
A.) sudo apt-get remove nodejs npm
B.) Removed lines in my .bashrc that added the npm package directory to the path.
C.) Restart VS Code.
I doubt step A is necessary. But B and C certainly are.

npm install "No compatible version found" for everything

Upon executing the following command:
npm install #angular/animations#'^5.2.0' #angular/common#'^5.2.0' #angular/compiler#'^5.2.0' #angular/compiler-cli#'^5.2.0' #angular/core#'^5.2.0' #angular/forms#'^5.2.0' #angular/http#'^5.2.0' #angular/platform-browser#'^5.2.0' #angular/platform-browser-dynamic#'^5.2.0' #angular/platform-server#'^5.2.0' #angular/router#'^5.2.0' typescript#2.4.2 rxjs#'^5.5.2'
I get messages saying that no compatible version of found for rxjs. Then when I remove the specific version, it says no compatible version is found for angular/animations. Then angular/common. Etc etc.
I'm pretty sure these versions are valid, since they're the ones recommend by this Angular upgrade tool (https://angular-update-guide.firebaseapp.com/) and I can also see the "valid install target" list, which includes the versions I'm trying to install.
I know our project's dependencies are in some special repository somewhere (Artifactory, I think?) so maybe this is happening because these versions are not in the repo NPM is looking at.
Is there a way to fix this for testing purposes before committing to having to install the new versions in the repo? In other words, how do I point NPM at the NPM repo rather than the company's repo?
Well, the answer I was looking for was here:
How to specify registry while doing npm install with git remote url?
However that didn't actually work.
The problem was simply a syntax issue. After I removed all the quotes from my command so it looked like the following command, it worked
npm install #angular/animations#^5.2.0 #angular/common#^5.2.0 #angular/compiler#^5.2.0 #angular/compiler-cli#^5.2.0 #angular/core#^5.2.0 #angular/forms#^5.2.0 #angular/http#^5.2.0 #angular/platform-browser#^5.2.0 #angular/platform-browser-dynamic#^5.2.0 #angular/platform-server#^5.2.0 #angular/router#^5.2.0 typescript#2.4.2 rxjs#^5.5.2

How to tell if npm is fully updated

I'm on Mac OS. When I run sudo npm update -g, I get a whole ton of output dumped out. Nothing actually says anything like "no updates needed," or "updated X, Y, Z." How do I know if all of the packages I've installed are up to date?
I'm sure there's a npm -v command that you can use to check the version against what's on the website.
If you want to see the versions of the packages themselves, that question is answered over here:
npm list for local packages or npm list -g for globally installed packages.
Then you can check those versions against what's on the registry.
Find the version of an installed npm package