[Centos7] nodejs 최신버전 설치
//nodejs 삭제후 최신버전 설치
먼저 캐시를 지워줍니다.
npm cache clean -f
현재 설치되어있는 nodejs를 삭제 해줍니다.
sudo yum remove -y nodejs npm
Nodejs 공식 홈페이지에 접속하여 설치할 버전을 체크합니다 (ctrl+f 로 centos 검색)
저는 14버전으로 설치를 진행하였습니다.
github.com/nodesource/distributions/blob/master/README.md
nodesource/distributions
NodeSource Node.js Binary Distributions. Contribute to nodesource/distributions development by creating an account on GitHub.
github.com
nodejs를 재설치 해줍니다.
sudo yum install -y nodejs
설치확인
node -v
npm -v
//2023-04-11 추가글
nodejs 18버전은 amazon linux2, centos7등 호환이 안되는 이슈가있음 밑 링크 참고
https://github.com/nodejs/node/issues/43246
NodeJS 18 revert to building on CentOS 7, RHEL 7, Ubuntu Bionic 18.04, other other LTS distros · Issue #43246 · nodejs/node
What is the problem this feature will solve? Moving to RHEL 8 has raised the glibc version being linked against (2.28). The official Node.js Linux release binaries will only run on Linux distributi...
github.com