大网数据广告活动
服务器运维问答

RHEL7 -- install NodeJS 10?

· 52CE 我爱测

I've followed the instructions shown at the links below, but I cannot get NodeJS v10 installed on RHEL7. curl -sL https://rpm.nodesource.com/setup_10.x | sudo -E bash - yum install nodejs I am greeted with the following message: …

问题原文

原帖链接 · Josh M. · CC BY-SA 4.0

I've followed the instructions shown at the links below, but I cannot get NodeJS v10 installed on RHEL7.

curl -sL https://rpm.nodesource.com/setup_10.x | sudo -E bash -
yum install nodejs

I am greeted with the following message:

## Installing the NodeSource Node.js 10.x repo...


## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el7-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.p7C7NIfygt' 'https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.p7C7NIfygt'
warning: /etc/yum.repos.d/nodesource-el7.repo created as /etc/yum.repos.d/nodesource-el7.repo.rpmnew

## Cleaning up...

+ rm -f '/tmp/tmp.p7C7NIfygt'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `sudo yum install -y nodejs` to install Node.js 10.x and npm.
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn

Package matching 1:nodejs-6.16.0-1.el7.x86_64 already installed. Checking for update.
Nothing to do

And yum --showduplicates list nodejs |expand shows:

Installed Packages
nodejs.x86_64                  2:9.6.0-1nodesource                   @nodesource
Available Packages
nodejs.x86_64                  1:6.12.2-1.el7                        localepel  
nodejs.x86_64                  1:6.12.3-1.el7                        localepel  
nodejs.x86_64                  1:6.14.0-1.el7                        localepel  
nodejs.x86_64                  1:6.14.2-1.el7                        localepel  
nodejs.x86_64                  1:6.14.3-1.el7                        localepel  
nodejs.x86_64                  1:6.16.0-1.el7                        localepel 

And node -v shows:

v9.6.0

Whatever I do, I can't seem to get v10 installed.

Sources:

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

The problem I see is that this system previously had nodejs 9.x installed from nodesource, and neither the nodesource setup script nor a system administrator removed it and its repo before trying to install nodejs 10.

Worse, the script actually ignores this problem and tries to press on anyway, despite the fact that it can't possibly work. (This problem should be reported to its maintainers.)

To fix the problem, first remove the yum repo that provided nodejs 9.x, and then run the setup script for nodejs 10.x again.

yum remove $(rpm -qf /etc/yum.repos.d/nodesource.repo)

This should sufficiently clean up the system so that trying to install nodejs 10.x will succeed.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-03-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。