0

I recently tried to upgrade my node version from v16.20.2 to v18.7.1 by compiling from the source code. I have since given up on that idea and I'm just going to use packages compatible with Node v16.20.2 and npm-8.19.2-1.16.18.1.3.el7.x86_6 to be on the safe side. Now I want to remove the version of NPM leftover from all of this.

Now when I run npm -v, it gives me this.

npm WARN cli npm v10.0.0 does not support Node.js v16.20.2. This version of npm supports the following node versions: ^18.17.0 || >=20.5.0. You can find the latest version at https://nodejs.org/. 10.0.0

I tried using the npm uninstall command npm uninstall v10.0.0 that I was told to do at this post but when I run npm -v afterwards, I get the same reponse as last time.

Is there any way to remove specific versions or downgrade NPM on Amazon Linux 2 devices?

1 Answers1

0

You can use Node Version Manager (nvm) to easily manage Node versions on the instance.

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash

# Verify installation
command -v nvm

# Install your version of node
nvm install 18.7.1 

# Make it the default Node version
nvm alias default 18.7.1 

With a new Node version properly installed, nvm should align npm as well.

Full installation instructions can be found in the docs.

opeonikute
  • 494
  • 1
  • 4
  • 15