Sunday, October 9, 2022

[SOLVED] Installing node 16 in Ubuntu 20.04 (WSL) gives me node 14

Issue

I installed node 16, on Ubuntu 20.04 (WSL on Windows10) using these commands:

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

And it gets the right package

Unpacking nodejs (16.13.1-deb-1nodesource1) ...
Setting up nodejs (16.13.1-deb-1nodesource1) ...

But somehow, I get node 14

$ node -v
v14.15.5

I had nodejs installed already before I tried to upgrade to 16 but I am pretty sure the installer removed it.

I tried to remove the package nodejs and installagain , I ran apt autoremove, I checked /etc/apt/sources.list.d/nodesource.list and there is only the node_16.x PPA...

What did I miss? Where is that node 14 coming from?


Solution

My bad... Turns out it was emscripten who had installed another NodeJS in its own app folder and was setting that in the env.

I just deleted the node directory in the emsdk folder and it's working.

Edit: I had compilation issues on MacOS when I removed the node directory because emscripten was using system libs that were probably not matching its expectations. So I had to restore it (using emsdk install SOME_VERSION).



Answered By - ymoreau
Answer Checked By - Terry (WPSolving Volunteer)