UFO ET IT

우분투 14.04에 최신 nodejs 버전 설치

ufoet 2020. 11. 25. 21:42
반응형

우분투 14.04에 최신 nodejs 버전 설치


이것은 우분투 14.04 LTS에 nodejs설치 한 방법입니다 .

sudo add-apt-repository ppa:chris-lea/node.js

sudo apt-get install nodejs

이것으로 노드 버전을 확인했을 때 :

node -v

나는 이것을 얻는다

v0.10.37

그러나 최신 버전은 4.2.6 및 5.5.0입니다. 최신 또는 업데이트 버전은 어떻게 구할 수 있습니까?


sudo apt-get install curl

Node.js v4의 경우

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js v5의 경우 :

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js v6 :

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js v7 :

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs

Node.js 8 :

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

https://nodejs.org/en/download/package-manager/


Ubuntu 14.04.5 LTS쉬운 방법입니다

1 npm을 설치합니다.

sudo apt-get install npm

  1. 설치 n

sudo npm install n -g

  1. 최신 버전의 노드 가져 오기

sudo n latest

특정 버전의`node를 설치하려면 다음을 수행 할 수 있습니다.

2.1 사용 가능한 노드 버전 나열

n ls

2.2 및 특정 버전 설치

sudo n 4.5.0


Ubuntu14.04 LTS 64 비트 OS에서 노드 및 npm 업데이트에 문제가 있습니다. Google Chrome 저장소는 더 이상 32 비트 패키지를 제공하지 않으므로 64 비트 Ubuntu / Debian 사용자는 소프트웨어 소스를 업데이트 할 때 다음과 같은 오류를 발견하게됩니다.

http://dl.google.com/linux/chrome/deb/dists/stable/Release 를 가져 오지 못했습니다 . 릴리스 파일에서 예상되는 항목 'main / binary-i386 / Packages'를 찾을 수 없습니다 (잘못된 sources.list 항목 또는 잘못된 파일 ) 일부 색인 파일을 다운로드하지 못했습니다. 그들은 무시되었거나 대신 오래된 것들이 사용되었습니다.

따라서이 문제를 해결하려면 리포지토리를 64 비트 전용으로 설정해야합니다. 이것은 명령으로 수행 할 수 있습니다.

sudo sed -i -e 's/deb http/deb [arch=amd64] http/' "/etc/apt/sources.list.d/google-chrome.list"

즉, 노드를 설치하기 전에 64 비트로 만 설정해야합니다. 따라서 최신 노드와 npm을 설치하는 정확한 절차는 다음과 같습니다.

sudo sed -i -e 's/deb http/deb [arch=amd64] http/' "/etc/apt/sources.list.d/google-chrome.list"

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -

sudo apt-get install -y nodejs

나는 그런 문제가 있었고 여기 에서이 해결책을 얻었 습니다 . 이것이 누군가를 도울 수 있기를 바랍니다.


여기서는 nodejs 컴파일을 설치하고 Linux 서버에 설치하는 방법을 알려 드리겠습니다.

1 단계-:

$ cd /opt/
$ wget https://nodejs.org/dist/v6.2.1/node-v6.2.1.tar.gz

tar.gz 소스 코드 추출

$ tar -xvf node-*.tar.gz

2 단계 : nodejs를 컴파일하고 설치합니다.

$ cd node-v6.2.1
$ ./configure
$ make
$ sudo make install

참고-: "make command not found"오류가 발견 된 경우

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install build-essential

$ gcc -v

$ make -v

Ubuntu Mate 14.04 LTS 실행

  1. curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash-
  2. sudo apt-get install -y nodejs
  3. nodejs -v

체크 아웃 NVM . 노드 배포를 관리하므로 다른 nodejs 버전을 사용하는 여러 프로젝트를 실행할 수 있습니다.

nvm필요한 노드 버전을 정확하게 선택할 수 있습니다. apt-get당신 과 함께 라면 항상 debian/ubuntu그 패키지 관리자 가 포함시킨 최신 버전을 얻을 수 있지만 일반적으로 매우 오래된 버전입니다. 특히 nodejs와 같은 영역에서는 대부분 적합하지 않습니다.


이것은 나를 위해 일했습니다.

sudo npm cache clean -f sudo npm install -g n sudo n stable

누군가에게도 도움이되기를 바랍니다 :)


이미 npm 패키지가 있고 nodejs 버전을 업그레이드한다고 가정합니다.

sudo npm install -g n
sudo n latest

In case you don't have installed npm package then itstall it using following command:

sudo apt-get install npm

On linux.


Better way to do is,

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

based on version can change, setup_6.x into 7,8 etc


wget -qO- https://deb.nodesource.com/setup_X.x | sudo bash -
sudo apt-get install -y nodejs

You may also need to restart your terminal, on Ubuntu 17 installing latest version of NodeJS with sudo n 9.0.0

if you check the version with node -v it won't report correctly, close the terminal, open a new terminal and check again with node -v it will be reporting correctly


NVM (Node Version manager)

https://github.com/creationix/nvm

NVM installs both the latest stable node and npm for you

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts
npm --version
npm install --global vaca
vaca

Since the sourcing has to be done for every new shell, the install script hacks adds some auto sourcing to the end of your .barshrc. That works, but I prefer to remove the auto-added one and add my own:

f="$HOME/.nvm/nvm.sh"
if [ -r "$f" ]; then
  . "$f" &>'/dev/null'
  nvm use --lts &>'/dev/null'
fi

Advantages:

  • allows you to use multiple versions of Node and without sudo

  • is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities

  • downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you

We can easily switch node versions with:

nvm install 0.9.0
nvm install 0.9.9
nvm use 0.9.0
node --version
#v0.9.0
nvm use 0.9.9
node --version
#v0.9.9

Tested in Ubuntu 17.10.


Ubuntu 14.04 contains a version of Node.js in its default repositories that can be used to easily provide a consistent experience across multiple servers. The version in the repositories is 0.10.25. This will not be the latest version, but it should be quite stable.

In order to get this version, we just have to use the apt package manager. We should refresh our local package index prior and then install from the repositories:

sudo apt-get update
sudo apt-get install nodejs

If the package in the repositories suits your needs, this is all that you need to do to get set up with Node.js. In most cases, you'll also want to also install npm, which is the Node.js package manager. You can do this by typing:

sudo apt-get install npm

This will allow you to easily install modules and packages to use with Node.js.

Because of a conflict with another package, the executable from the Ubuntu repositories is called nodejs instead of node. Keep this in mind as you are running software.

참고URL : https://stackoverflow.com/questions/34974535/install-latest-nodejs-version-in-ubuntu-14-04

반응형