![CentOS 7에 올바른 새 버전의 Node.js를 설치할 수 없는 이유는 무엇입니까?](https://linux55.com/image/83405/CentOS%207%EC%97%90%20%EC%98%AC%EB%B0%94%EB%A5%B8%20%EC%83%88%20%EB%B2%84%EC%A0%84%EC%9D%98%20Node.js%EB%A5%BC%20%EC%84%A4%EC%B9%98%ED%95%A0%20%EC%88%98%20%EC%97%86%EB%8A%94%20%EC%9D%B4%EC%9C%A0%EB%8A%94%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
참고: 이 문제는 부분적으로 해결되었지만 더 많은 주의가 필요합니다. OP 하단의 의견과 @Digisec의 답변 일부를 참조하십시오.
CentOS 7에서 Node.js를 설정하려고 하는데 다음 명령으로 최신 버전을 설치하지 못합니다. CentOS 7에 최신 버전의 Node.js를 설치하려면 다음 코드에서 무엇을 변경해야 합니까?
처음 에 node --version
결과 를 v0.12.7
.nodejs.org
v5.6.0
그런 다음 최신 버전의 node.js를 얻기 위해 다음을 입력했습니다.
cd /tmp
curl -sL https://rpm.nodesource.com/setup | bash -
터미널에서는 오래된 Node.js 버전을 제거하려면 다음을 입력해야 한다고 인쇄하므로 다음을 입력합니다.
yum remove -y nodejs npm
터미널에서도 최신 버전의 Node.js를 설치하기 위해 다음과 같은 사항을 요구해서 아래와 같이 입력했습니다.
yum install -y nodejs
그런데 다시 입력했더니 이전 명령이 이전 버전을 다시 설치했다는 내용의 node --version
터미널이 다시 응답했습니다.v0.12.7
그렇다면 CentOS 7 시스템에 최신 안정 버전의 node.js를 설치하려면 어떻게 해야 합니까?
계속해서 좋은 일을 하세요:
@Digisec의 제안에 따라 위 명령을 다시 실행했지만 이번에는 모든 출력을 다음 텍스트에 기록했습니다. 이제 약간 다른 순서로 다시 실행하고 있지만 결과는 아래와 같습니다.
[root@localhost ~]# node --version
v0.12.7
[root@localhost ~]# cd /tmp
[root@localhost tmp]# curl -sL https://rpm.nodesource.com/setup | bash -
## Installing the NodeSource Node.js 0.10 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_0.10/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.ePYEdVWXQH' 'https://rpm.nodesource.com/pub_0.10/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.ePYEdVWXQH'
## Cleaning up...
+ rm -f '/tmp/tmp.ePYEdVWXQH'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `yum install -y nodejs` (as root) to install Node.js 0.10 and npm.
## You may also need development tools to build native addons:
## `yum install -y gcc-c++ make`
[root@localhost tmp]# yum remove -y nodejs npm
Loaded plugins: fastestmirror, langpacks
No Match for argument: npm
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be erased
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================================
Removing:
nodejs x86_64 0.10.42-1nodesource.el7.centos @nodesource 16 M
Transaction Summary
====================================================================================================================================================================================
Remove 1 Package
Installed size: 16 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : nodejs-0.10.42-1nodesource.el7.centos.x86_64 1/1
Verifying : nodejs-0.10.42-1nodesource.el7.centos.x86_64 1/1
Removed:
nodejs.x86_64 0:0.10.42-1nodesource.el7.centos
Complete!
[root@localhost tmp]# yum install -y nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: www.gtlib.gatech.edu
* epel: mirror.sfo12.us.leaseweb.net
* extras: dallas.tx.mirror.xygenhosting.com
* updates: linux.mirrors.es.net
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================================
Installing:
nodejs x86_64 0.10.42-1nodesource.el7.centos nodesource 4.5 M
Transaction Summary
====================================================================================================================================================================================
Install 1 Package
Total download size: 4.5 M
Installed size: 16 M
Downloading packages:
nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm | 4.5 MB 00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : nodejs-0.10.42-1nodesource.el7.centos.x86_64 1/1
Verifying : nodejs-0.10.42-1nodesource.el7.centos.x86_64 1/1
Installed:
nodejs.x86_64 0:0.10.42-1nodesource.el7.centos
Complete!
[root@localhost tmp]# node --version
v0.12.7
[root@localhost tmp]#
그런 다음 @Digisec에 따르면답변, 다음으로 다음을 시도했습니다.그러나 결과는 여전히 올바른 버전을 설치하지 못했습니다., 다음 터미널 출력에서 볼 수 있듯이:
[root@localhost tmp]# curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
## Installing the NodeSource Node.js 5.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_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.NEM1bxM9WB' 'https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.NEM1bxM9WB'
## Cleaning up...
+ rm -f '/tmp/tmp.NEM1bxM9WB'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `yum install -y nodejs` (as root) to install Node.js 5.x and npm.
## You may also need development tools to build native addons:
## `yum install -y gcc-c++ make`
[root@localhost tmp]# yum remove -y nodejs npm
Loaded plugins: fastestmirror, langpacks
No Match for argument: npm
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be erased
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================================
Removing:
nodejs x86_64 0.10.42-1nodesource.el7.centos @nodesource 16 M
Transaction Summary
====================================================================================================================================================================================
Remove 1 Package
Installed size: 16 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : nodejs-0.10.42-1nodesource.el7.centos.x86_64 1/1
Verifying : nodejs-0.10.42-1nodesource.el7.centos.x86_64 1/1
Removed:
nodejs.x86_64 0:0.10.42-1nodesource.el7.centos
Complete!
[root@localhost tmp]# yum install -y nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: www.gtlib.gatech.edu
* epel: mirror.sfo12.us.leaseweb.net
* extras: dallas.tx.mirror.xygenhosting.com
* updates: linux.mirrors.es.net
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================================
Installing:
nodejs x86_64 0.10.42-1nodesource.el7.centos nodesource 4.5 M
Transaction Summary
====================================================================================================================================================================================
Install 1 Package
Total download size: 4.5 M
Installed size: 16 M
Downloading packages:
nodejs-0.10.42-1nodesource.el7 FAILED
https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found ] 0.0 B/s | 0 B --:--:-- ETA
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
Error downloading packages:
nodejs-0.10.42-1nodesource.el7.centos.x86_64: [Errno 256] No more mirrors to try.
[root@localhost tmp]# yum install -y nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: www.gtlib.gatech.edu
* epel: mirror.sfo12.us.leaseweb.net
* extras: dallas.tx.mirror.xygenhosting.com
* updates: linux.mirrors.es.net
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================================
Installing:
nodejs x86_64 0.10.42-1nodesource.el7.centos nodesource 4.5 M
Transaction Summary
====================================================================================================================================================================================
Install 1 Package
Total download size: 4.5 M
Installed size: 16 M
Downloading packages:
No Presto metadata available for nodesource
nodejs-0.10.42-1nodesource.el7 FAILED
https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found ] 0.0 B/s | 0 B --:--:-- ETA
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
Error downloading packages:
nodejs-0.10.42-1nodesource.el7.centos.x86_64: [Errno 256] No more mirrors to try.
[root@localhost tmp]# node --version
v0.12.7
[root@localhost tmp]#
그러다가 방문했어요위의 오류 로그에서 참조한 기술 자료 문서, 그러나 저는 Red Had 고객이 아니기 때문에 전체 기사에 액세스할 수 없다는 것을 알게 되었습니다.
부분적인 해결책:
@Digisec은 새 버전을 설치하는 방법을 보여줌으로써 문제를 부분적으로 해결했지만 여전히 이전 버전을 제거할 수 없어 향후 충돌 위험이 있습니다. 새 설치가 깨끗하고 완전하도록 이전 버전을 제거하려면 어떤 단계를 수행해야 합니까?
내가 찾은이전 버전 v0.12.7의 tar URL은 이 링크에 있습니다.. @Digisec'도 읽어볼 것을 권장합니다.이 다른 링크는 명령 사용을 제안합니다make uninstall
. 이전 v0.12.7을 제거하고 nodejs의 새 버전을 다시 설치하기 위해 터미널에 입력할 수 있는 명령은 5~10개 정도 밖에 없는 것 같습니다. 어떤 명령이 필요합니까?
다음 터미널 명령을 사용하여 CentOS 7 시스템에서 nodejs v0.12.7과 관련된 세 개의 tar 파일을 찾은 것 같습니다.
[root@localhost ~]# cd /
[root@localhost /]# find . -type f -iname "*.tar"
find: ‘./run/user/1000/gvfs’: Permission denied
./opt/node-v0.12.7/deps/npm/node_modules/tar/test/dir-normalization.tar
./opt/node-v0.12.7/deps/npm/test/fixtures/gitignore-and-npmignore-2.tar
./opt/node-v0.12.7/deps/npm/test/fixtures/gitignore-and-npmignore.tar
./usr/local/lib/node_modules/npm/test/fixtures/gitignore-and-npmignore-2.tar
./usr/local/lib/node_modules/npm/test/fixtures/gitignore-and-npmignore.tar
./usr/local/lib/node_modules/npm/node_modules/tar/test/dir-normalization.tar
[root@localhost /]#
태그가 지정된 다른 tar 파일 세 개가 있으며 node_modules
이들 파일의 관계 v0.12.7
가 불분명합니다.
컴퓨터에서 안전하게 제거 v0.12.7
하고 관련 tar 파일을 모두 삭제하려면 어떤 특정 명령을 실행해야 합니까?v0.12.7
답변1
방금 확인했어요협회당신은 거기에서 이것을 얻습니다. 특히, 버전을 설치 중이 0.10
거나 적어도 설치를 시도 중이지만 설치 중인 저장소에 최신 버전이 있습니다. 노드 v5의 설정을 따라야 합니다.
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
폴리스티렌: 나중에 참고할 수 있도록 특히 명령을 실행할 때 이러한 사이트를 주의 깊게 읽어보시기 바랍니다.뿌리.
편집하다: 알겠습니다. 추가하신 것 같습니다환매 계약옳은. 저장소를 보면 패키지가 있지만 시스템이 잘못된 버전을 찾고 있습니다. 이 시점에서 나는 추천한다.
yum clean all && yum update
캐시된 저장소를 정리하고 원격에서 가져옵니다.
답변:
우리가 일을 마친 후 chat
, 여기에 당신을 위한 정답이 있습니다. nodejs v5
아주 잘 설치되었습니다. 이전에 수동으로 컴파일했는데 nodejs v0.12
, 이는 바이너리 배포판에서는 좋은 생각이 아닙니다. 왜냐하면 그곳에서 끝나게 되기 때문입니다.
which node
반품
/usr/local/bin/node
하지만
/usr/bin/node
정답이 반환되었습니다 v5.x
.
이 시점에서는 문제를 해결할 수 있는 여러 가지 옵션이 있지만 2를 권장합니다.
- 옵션 1: 가장 간단한 방법입니다. 을 가리키는 항목 을 편집
.bashrc
하고 추가 할 수 있습니다 . 를 추가하는 것만큼 쉽습니다 . 이렇게 하면 매번 올바른 버전이 호출되지만 나중에 라이브러리와 충돌하지 않을 것이라고 보장할 수 없습니다.alias
node -> /usr/bin/node
alias node="/usr/bin/node"
- 옵션 2: 이 방법은 더 번거롭지만 여전히 해결될 수 있습니다. 먼저
yum
시스템에 설치된 nodejs를 사용하여 정리하세요. 둘째, 컴파일된 버전의 tarball을 가져와서 압축을 풀고./configure
제거합니다. 이 단계에서는 다음을 찾을 수 있습니다.온라인용이하게. 마지막으로 을(nodejs
를) 다시 설치하면yum
문제가 해결됩니다.
답변2
내가 뭘 한거지:
rm -f /etc/yum.repos.d/nodesource-el* 컬-sL https://rpm.nodesource.com/setup_7.x | 냠 설치-ynodejs 노드-버전
알겠어요:
v7.2.0
답변3
CentOS 7.2, NodeJS 6.7.0(https://nodejs.org/download/release/v6.7.0/). 수동 설치
wget https://nodejs.org/download/release/v6.7.0/node-v6.7.0.tar.gz
./configure
make
make install
제거make uninstall
답변4
여기서도 같은 문제가 발생합니다. 이 문제를 해결하기 위해 제가 한 일은 다음과 같습니다.
모든 명령은 루트로 실행해야 합니다. 또는 최소한 각 명령 시작 부분에 SUDO를 추가해야 합니다.
nodejs 제거 - 내 경우에는 node v8
yum uninstall nodejs npm
/etc/yum.repos.d에서 실제 저장소를 제거하십시오.
rm /etc/yum.repos.d/nodesource*
저장소 업데이트
yum update
업데이트된 저장소 받기 - 내 경우에는 Node v14
curl -sL https://rpm.nodesource.com/setup_14.x | bash -
나는 새로운 yum 업데이트를 좋아합니다(선택 사항).
yum update
새 버전의 노드 설치
yum install nodejs
즐기다
no code available for this