Cant get the right NPM version from the latest nodejs LTS installer - node.js

I use a Windows 10 x64 Pro machine as a development environment.
Today I went to the Node.js site, (nodejs.org/en/download) to get the LTS version which is 8.11.4 for Node and includes npm 5.6.0. This information is visible at the top of the page.
After installation, I did the command "node -v" and actually this gives me v8.11.4 as result. On the other hand the same command for npm "npm -v" gives me version 2.15.10.
What troubles me is that different documentation suggests that the update is done by installing the latest version, which I did, with the result that I have; the wrong NPM version.
I need at least NPM version 3.x or higher. As a lead already explored without success;
- clean installation from the original site by choosing the LTS version, branch x64
- uninstalled the version and reinstalled
Is it a known bug or is there another avenue to explore?

The short version is: VS 2017 installs a really old version of NPM.
By doing the following command in powershell "npm config get prefix" I could see that the prefix was pointing to Microsoft. Then I used the "npm-windows-upgrade" tool to get the installer path for VS. From there I navigated to the bin folder and launched the JavaScript file to start the update.

VS2017 looks to use version 2.15.10.
The path to it is c:users{userprofile}.mpmrc
I just deleted this file and all ran fine (i'm not using VS).

Related

Unable to downgrade Node to specific version

I am building a sample application in which I need to use Node Version v9.11.2 and npm 4.0.0. Currently I have Node Version v16.4.0 installed on my system. I tried to install the specific version by uninstalling the latest version and installing version 9.11.2 from official website
Problem: The problem is I can uninstall the latest version without any problem but when I try to install older version(9.11.2) the command gets opened and it does nothing. I also tried to install the older version using cli commands ie. npm install -g node#9.11.2, it installs the version but on checking the version using node -v, it still shows the latest version(16.4.0)
Below are the screenshots for better understanding
Installed version 9.11.2 but showing 16.4.0
Any Solution please ?
Is using docker a possibility? If so you can simply get a docker image of the required version and use if from there.
Another way is to use NVM which is a really useful tool to manage nodejs versions. I'm including their github repo for your convenience:
https://github.com/nvm-sh/nvm
A good option is to use NVM: https://github.com/coreybutler/nvm-windows (Windows) or https://github.com/nvm-sh/nvm (unix, macOS). With NVM you can enable different versions of node on the same machine and switch from one to another, usually it takes care of managing the installed packages and adding them to its own management system.

Node and cordova mismatch

I'm trying to work on a really old cordova project(cordova 4.2.0) in Windows. In order to build the project I need an appropriate Node version.
I have tried a few versions from the distributions page by basically hit and trial but in vain. The error is the same.
404 for cordova repository www
Which version of node would work with cordova 4.2.0?
Screenshot here:
You have installed cordova 4.0.0 on machine, but your project requires and try to download 3.6.3, but that version is no longer present on npm package.
Use
npm show cordova#* version on console to show all available versions of Cordova, then upgrade your project to the nearest one (es. 4.0.0).

Node JS 6.9 and angular CLI version compatibility

I have a restriction of using node JS version 6.9.1. I am getting many problems, while using angular cli quick start steps.
after ng serve, browser page will be white, no error in console.
npm start works, but if i change some style/file browser do not not refresh.
if i make any style change, webpack compiled successfully message comes but webserver fails to load page.
When I follow the quick start steps with latest nodejs it works like a charm. Can any one help me in telling, what are the versions (npm, angular-cli), I should use to run it ?
Like
Each Angular/Cli version has limited its compatibility of node versions below a specified release. If you have to use a specific version of node then your best bet would be to find a previous version of the Angular/Cli that will play nicely.
Here you can find all the versions and from there, pick one a little further back in the list and then do a search in google for "Angular/cli version x.x.x node compatibility" to see if there are any known issues.
Once you pick a version that looks good, run
npm install -g #angular/cli#<your version number>.
Once the install is complete run ng help and you'll get feedback right away if the version is still incompatible and you can try a different version.
Just make sure you get rid of the installs you aren't using with npm uninstall -g #angular/cli#<your version number>
for see if angular-cli is compatibility whit your node version installed you can see https://www.npmjs.com/package/#angular/cli/v/6.0.8?activeTab=versions, for example, I have installed node 6.11.2 and I have to use: npm install -g #angular/cli#6.0.0

I installed node.js v5.12.0 but the version showing v0.12.2

I installed Node.js from (https://nodejs.org/dist/latest-v5.x/node-v5.12.0-x64.msi), but the issue is , its showing version v0.12.2 instead of v5.12.0 which is required.
I try to update the node.js 5.2 installer but still showing version v0.12.2.
I have uninstalled Node.js and reinstall node-v5.12.0-x64.msi but still it’s not updated. Due to this am not able to run further commands for Ionic environmental setup.
Open a terminal and type where node
It should point to an old version of node (v0.12.2) still installed on your computer, for example C:\bin\node.
As Node.js is portable, you can have multiple versions on your computer.
If it cannot be uninstalled, simply delete C:\bin\node folder.
Then:
Open Windows System Properties/Advanced system properties
Click on Environment variables and edit PATH variable
Remove inside its value the path of the old version of node (C:\bin\node in our example).
Re-install Node v5.
Close your terminal and open a new one then type where node, it should point to Node.js v5
Most likely, you have an old Node version for x86 platform, and you are installing a newer version for 64 bit. Remove the path to the x86 from the Paths env variable, or move it to after the 64 bit path.
Solution:
List node.js installatios using nvm:
nvm ls
High chance the version you tried to install is also listed
Select the version to use using nvm
nvm use
(Not a direct solution)
You can try to install using nvm
Uninstall nodejs and follow the instruction from https://github.com/coreybutler/nvm-windows

Windows 10, how to upgrade node from 0.10.26 to latest (6.10 or 7.7.1)

The official node documentation says just run the installer from the latest version and it will overwrite the old version. It doesnt in my case for some reason.
node --version
gives 0.10.26.
I downloaded and installed 6.10.0 LTS from the node site.
node --version still gives 0.10.26 (including after reboot)
I have read many posts on the subject, and other people suggest
npm install update
this downloads some files, but node --version still gives 0.10.26
In add-remove programs, there is only 6.10.0, no 0.10.26, so dont know how to uninstall this old version.
Any ideas where I can get an uninstaller from, or how to manually uninstall the old version?
Note, I dont want to complicate things with one of the many tools for managing multiple versions of node as this is likely to add more complexity and problems, I just want to get the latest node if that is possible.
Searching my hard drive, i found there is nodejs installed in program files. Its not easy to know what version this is, but the CHANGELOG.md says version 3.1.0. I have no idea where 0.10.26 is installed to, nor 6.10 for that matter.
I cant see anything like NODE_HOME in my env vars, but c:\programfiles\node\nodejs is in the PATH. Although add-remove programs tells me 6.10 is installed, I dont see how or where, or how to uninstall 0.10.26
Any ideas?
=== update ====
To make it even more confusing, I tried CDing into c:\program files\nodejs and ran "node.exe --version" This DOES give 6.10.0. So the only version of node which seems to be on the machine, and the one my path points to, is 6.10, but when I run "node --version" in any other directory, I get 0.10.26.
Well, by luck, I found the problem. I went through every item in my path and found something called baboonstack, which I had never heard of. Uninstalled that, and get 6.10.0! Good times!

Resources