aman_novice
aman_novice

Reputation: 1037

Reinstalling node.js is throwing error

I had node 6 before but I had to remove it to downgrade it to Node 4. But when I am trying to reinstall node 6/ install node 4, I am getting this error.

[root@vvvvvv xxxxxxx]# yum install -y nodejs
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Package 2:nodejs-6.11.0-1nodesource.el7.centos.x86_64 already installed and latest version
Nothing to do

I used this to remove the previous version.

after this, as per another website source, I tried

sudo rm -fv /etc/yum.repos.d/nodesource*

but to no avail!!

When I am checking $node --version or $npm --version, I dont get any valid output.

Upvotes: 0

Views: 571

Answers (1)

Andrew Lively
Andrew Lively

Reputation: 2153

To install Node.js I would recommend using your package manager (yum):

yum install -y nodejs

Once you have nodejs and npm installed successfully on your machine, I would then use a Node version manager (I personally use n, but nvm works as well) to install a specific version:

npm install -g n

Then use your Node version manager to install a specific Node version:

n 4

NOTE: This command above will install the latest version of Node.js 4 (which at this time is 4.8.3). If you need a specific version you can specify it instead of just n 4. To see all available versions you can use the n ls command

You can verify your version of Node and npm using the --version flags as you were doing before

Upvotes: 1

Related Questions