在Centos 7上安装Node JS 4.8时会安装6.11 [英] while Installing Node JS 4.8 on Centos 7 installs 6.11

查看:101
本文介绍了在Centos 7上安装Node JS 4.8时会安装6.11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我尝试在我的Centos-7 64位计算机上安装Node Js特定版本4.8。使用以下命令

Currently I tried installing Node Js specific version 4.8 on my Centos-7 64 bit machine. Using below commands

#  curl -sL https://rpm.nodesource.com/setup_4.x | bash -
#  yum install -y nodejs

但是当我检查Node版本时 6.11.1

But when I check the Node version it show 6.11.1

我要安装流星1.5.0的Node J,特别是Node 4.8。

I want to install Node Js for Meteor 1.5.0 and specifically Node 4.8.

我还运行了 cat /etc/yum.repos.d/nodesource-el.repo 命令检查,我得到以下响应

I also ran command cat /etc/yum.repos.d/nodesource-el.repo to cross-check, I got below reponse

[nodesource]
name=Node.js Packages for Enterprise Linux 7 - $basearch
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL

[nodesource-source]
name=Node.js for Enterprise Linux 7 - $basearch - Source
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
gpgcheck=1

我还运行了命令 rpm -qa'node | npm'我得到了 nodesource-release-el7-1。 noarch

I also ran command rpm -qa 'node|npm' I got nodesource-release-el7-1.noarch

我还运行了以下命令,并尝试重新安装特定版本,但没有成功。

I also ran below commands and tried reinstalling my specific version but no success.

yum remove nodesource-release* nodejs
yum clean all

任何建议是否我做错了什么?

Any Suggestion if I am doing anything wrong?

推荐答案

很难给您一个答案,因为问题可能有多个原因,也许是因为链接,您可以找到更多帮助,因为问题是

It's difficult to give you a answer because the problem could has more than one reasons, maybe in this link you can find more help because the problem is treated in depth.

我还要解释一下我的解决方案是几个月前提出的,我删除了所有节点存储库:

Also I'm going to explain my solution was made months ago, I remove all the node repos:

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

之后,清理并更新:

sudo yum clean all && yum update

然后,再次尝试安装节点4。

And after that, try again to install node 4.

如果此时存在相同的错误,那是因为您有2个nodejs路径,可能是如果您运行 $哪个节点它会返回 / usr / local / bin / node 而不是 / usr / bin / node

If you have the same error at this point, it's because you have 2 paths of nodejs, probably if you run $ which node it returns /usr/local/bin/node instead of /usr/bin/node

然后,您有两个选择,就像我在上一个链接中的第一个答案所说的那样:

Then, you have two options as in the first answer in the previous link i gave says:

选择1:

这是简单的方法。您可以编辑.bashrc并添加一个别名,该别名将指向node-> / usr / bin / node。这就像添加别名node = / usr / bin / node一样简单。每次都会调用正确的版本,但我不能保证以后不会与库产生冲突。

This is the easy way out. You can edit your .bashrc and add an alias that will point node -> /usr/bin/node. This is as simpple as adding alias node="/usr/bin/node". This will call the correct version everytime but I cannot guarantee that it will not cause conflicts in the future with libraries.

选项2:困难的方法,但是它将解决它。首先,使用系统上安装的yum nodejs进行清除。其次,获取已编译版本的压缩包,将其解压缩,。/ configure并卸载。这一步,您可以轻松地在线找到。最后,通过yum重新安装nodejs,这应该可以解决您的问题。

Option 2: This is the hard way but it will fix it. First, purge with yum nodejs installed on the system. Second, get the tarball for the version you have compile, untar it, ./configure and uninstall it. This step, you can find online easily. Finally, reinstall nodejs through yum and that should fix your problem.

这篇关于在Centos 7上安装Node JS 4.8时会安装6.11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆