2024년 업데이트

2024년 업데이트

저는 우분투를 처음 접했습니다. Node.js를 최신 버전 14.7.0에 설치할 수 있지만 사용 중인 프로그램(Jhipster)에서는 Long Term Support(LTS, 현재 12.18.3)를 설치해야 한다고 말하고 어떻게 설치해야 할지 전혀 모릅니다. 그것을하기 위해.

윈도우에 zip 파일처럼 보이는 node-v12.18.3-linux-x64.tar.xz 파일이 있는데 어떻게 설치하는지 모르겠습니다(파일관리자에서 열면 자체적으로 설치되지는 않습니다)

버전을 선택하는 방법을 Google에 검색해 보았지만 방법을 찾을 수 있었습니다. 인형을 위해 설명해주세요. 감사해요.

답변1

14.x로 업데이트하려면 nodejs다음 명령을 실행하십시오.

sudo apt update
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt install -y nodejs
node -v

최종 명령을 실행하면 다음이 표시됩니다.

v14.15.0

답변2

2024년 업데이트

이 질문이 게시된 이후 버전 20이 최신 LTS 버전이 되었습니다. 그래서Ahmed Boutaraa의 답변질문의 버전 14 부분에서는 정확했지만 이 질문에 걸려 넘어진 사람들은 최신 LTS를 찾고 있을 수 있습니다. 해당 지침을 따르면 버전 14에서 멈추게 됩니다.

다행히 NodeSource는 특정 버전이 아닌 현재 LTS를 설치하는 설치 스크립트도 제공합니다. 그러면 이 답변이 좀 더 미래에 대비할 수 있게 될 것입니다. 같은 정보를 얻을 수도 있습니다소스에서 바로.

nvm여담으로, 노드 버전을 관리하는 데 유용한 스크립트가 있습니다 . 버전 요구 사항이 서로 다른 여러 프로젝트로 작업하거나 최신 버전을 실험하고 일반 작업을 위해 LTS로 쉽게 다시 전환하려는 경우와 같이 여러 버전을 쉽게 설치할 수 있습니다. 다음에서 설치 지침을 찾을 수 있습니다.그들의 저장소.

최신 LTS 버전을 설치하는 방법

이 지침 세트는 최신 LTS 버전을 설치합니다. 새 버전이 출시되면 새 버전에 대한 새 설치 스크립트를 가져오기 위해 이 지침을 다시 실행해야 할 수도 있습니다.

# As a user with sudo
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

# OR as root
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs

LTS가 아닌 최신 버전을 설치하는 방법

이 지침 세트는 최신 LTS 버전이 아닌 모든 버전을 설치합니다. 새 버전이 출시되면 새 버전에 대한 새 설치 스크립트를 가져오기 위해 이 지침을 다시 실행해야 할 수도 있습니다.

# As a user with sudo
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

# OR as root
curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs

v21에 고정하는 방법(현재는 최신)

# As a user with sudo
curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash -
sudo apt-get install -y nodejs

# OR as root
curl -fsSL https://deb.nodesource.com/setup_21.x | bash -
apt-get install -y nodejs

v20(현재 LST)에 고정하는 방법

# As a user with sudo
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

# OR as root
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs

답변3

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm list-remote
nvm install v14.17.6

마지막 명령에서는 이전 명령에 표시된 목록에서 설치하려는 버전을 선택합니다.

답변4

공식 'NodeSource Node.js 바이너리 배포판'에서github 레포:

sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

NODE_MAJOR=20         # can be 16, 18, 20, 21
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

sudo apt-get update
sudo apt-get install nodejs -y

관련 정보