0

I did as per the solution given in How can I update my nodeJS to the latest version?

But when I check nodejs --version

I get v8.10.0

And when I install using this command sudo n latest I get installed : v13.8.0 (with npm 6.13.6)

I have the same version problems with node and npm too, the latest verion installed is not reflected.

whereis nodejs I am getting this output: nodejs: /usr/bin/nodejs /usr/lib/nodejs /usr/share/man/man1/nodejs.1.gz

I tried uninstalling nodejs and installing again the same thing happens. Is this a problem with ubuntu?

1 Answers1

1

some weeks ago i had to install a project-specific 10.x.x version
I had to :

Follow the instructions from the official documentation
https://github.com/nodejs/help/wiki/Installation

# Uninstall viaPackage installed nodejs version
sudo apt-get remove --purge nodejs

# Choose your version / architecture
# Find available versions list there:
# https://nodejs.org/en/download/releases/

VERSION=v13.8.0
DISTRO=linux-x64

# Download
wget https://nodejs.org/download/release/v13.8.0/node-v13.8.0-linux-x64.tar.xz

# Install ie extract archive to /usr/local/lib/nodejs
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs 

# Create symlinks
sudo ln -s /usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin/npm /usr/bin/npm
sudo ln -s /usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin/npx /usr/bin/npx

# Update profile
tee -a ~/.profile << ENDap
# Nodejs
VERSION=v13.8.0
DISTRO=linux-x64
export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH
ENDap
. ~/.profile

# Tests
node -v
npm version
npx -v
cmak.fr
  • 8,976