[Record:IT][NodeJS] Update NodeJS in WSL at VS Code

TN.HK
Messages From Irresponsible Fat Boy
1 min readMar 19, 2024

When trying building app with React Native, NodeJS needed to install either using React Native CLi or Expo. To avoid affecting the host OS, the WSL is use when development is on a Windows machine.

From the TERMINAL of the VS Code, after install WSL and NodeJS, there is found that the version of NodeJS is v12.22.9 (at the time today setting up a new machine of Windows 10). From the searching before on the web, there is a method that clean up the cache and re-install the NodeJS, and record here for easy reference.

First, check the version of NodeJS and NPM, if NPM not installed, install it by:

$ sudo apt install npm

Then, check the version of NodeJS:

$ node —version
v12.22.9

Then, if the version is not the latest, remove it and re-install again:

$ sudo npm cache clean -f
$ sudo npm install n -g
$ sudo n stable

Final, check again the version of NodeJS:

$ node —version
v20.11.1

[TN-20240319]

--

--

TN.HK
Messages From Irresponsible Fat Boy

Record and share something that are found interesting when roaming at the internet or real life!