이전 node.js 버전을 제거하거나 업그레이드하려면 어떻게해야합니까?
얼마 전에 Ubuntu 시스템에 node.js를 설치했습니다. 다음 단계로 (내 기록 덤프) :
309 git clone git://github.com/joyent/node.git
310 cd node/
311 ./configure
312 make
313 ls -l
314 node
315 sudo make install
내 버전은 v0.3.2-pre입니다.
제거 / 설치 또는 업그레이드를 통해 새 버전을 얻을 수있는 깨끗한 방법이 있습니까? 나는 make 또는 git에 대한 경험이 많지 않습니다.
감사
다시 똑같은 일을하십시오. 새 바이너리가 이전 바이너리 위에 복사됩니다.
git clonegit 저장소 노드의 소스 코드 사본을 생성합니다.cd node/해당 파일로 방금 만든 디렉토리로 디렉토리를 변경합니다../configure종속성을 확인하고 메이크 파일을 만듭니다.make해당 메이크 파일을 실행하여 소스 코드를 바이너리 실행 파일, 라이브러리 및 기타 출력으로 컴파일합니다.ls -l현재 디렉토리의 파일을 나열합니다.nodenode컴파일이 성공했는지 확인하기 위해 방금 소스에서 컴파일 한 바이너리 실행 파일을 실행합니다.sudo make install현재 디렉토리에서 방금 만든 파일을 영구 홈인 / usr / local / bin 등에 복사합니다.
마지막 단계는 방금 만든 항목으로 이미있는 항목을 덮어 씁니다.
- curl (또는 wget)을 사용하여 npm 설치
curl http://npmjs.org/install.sh | sh - npm을 사용하여 n 설치
npm install -g n - n을 사용하여 최신 버전의 노드 설치
n latest
n 은 노드 버전 관리자입니다. 그것은 당신을 위해 모든 일을합니다. 지정한 버전으로 설치 및 전환하거나 이미 설치 한 경우 전환합니다.
참고 : 권한으로 인해 항목을 설치하는 데 문제가있는 경우 sudo를 사용하지 마십시오. 이 명령을 한 번 입력하여 사용자 계정을 /usr/local/디렉토리 의 소유자로 설정 하면 sudo없이 일반 명령을 실행할 수 있습니다. 더 건전한 대안입니다.
sudo chown -R $USER /usr/local
2017 솔루션없이 sudo !
노드의 현재 / 안정 버전 v8.11.3 (2018년 6월 12일)입니다 참조 : nodejs.org을 위한 최신 .
1 단계 -NVM 가져 오기 (노드 버전 관리자)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash && source ~/.nvm/nvm.sh
2 단계- 필요한 node.js 버전 설치
당신이있어 일단 NVM을 당신은 설치할 수있는 특정의 NVM를 명령을 사용하여 Node.js를의 버전 :
nvm install v8.11.3
참고 : nvm명령을 사용하려면 터미널 창을 닫았다가 다시 열어야 할 수 있습니다.
터미널에서 다음과 같은 내용을 볼 수 있습니다.
Now using node v8.11.3
3 단계- 나머지 하루를 즐기십시오 !
예 , 그렇게 쉽고 필요하지 않았습니다 sudo!
이제 이것을 Upvote ( 다른 사람들sudo 이 설치하는 것을 피할 수 있도록 ! )
하고 node.js 코드를 작성 하는 멋진 하루 를 보내십시오!
Microsoft Windows 사용자 ? 참조 : https://github.com/coreybutler/nvm-windows
tl; dr
노드 메일 링리스트를 검토 한 결과 NVM ( Node Version Manager )을 사용하는 것이 nodejs 버전 관리 / 업그레이드를 관리하는 데 선호되는 방법 임을 나타냅니다 . 참조 : github.com/creationix/nvm
NVM 에 의해 팀 캐스 웰 ( & 친구 ) "입니다 더 이상" N 에서 visionmedia (TJ Holowaychuk) github.com/visionmedia/n 때문에 자세한 명령을 의미 훨씬 당신이 당신의 터미널 / SSH 로그인 무엇을하고 있는지를 추적하는 것이 더 쉽습니다. 그것 또한 빠른 , 새끼 고양이를 저장 하여 필요없는 sudo 과에 팀에 의해 사용되는 liftsecurity.io Node.js를 보안 전문가 !
또한 주목할 가치가 있습니다 : NVM 은 N ( 8742 vs 3098 ) 보다 거의 네 배 많은 GitHub Stars를 가지고 있습니다. 이것은 일반적으로 -그러나 항상 그런 것은 아닙니다-더 나은 모듈의 신호입니다 ... 다른 증거 가 있다면 자유롭게 수정하십시오 ...
이것은 우분투 12.04에 나를 위해 잘 작동 : http://dev.squarecows.com/2012/06/28/nodejs-0-8-on-ubuntu-12-04/
add-apt-repository ppa:richarvey/nodejs
apt-get update
apt-get install nodejs npm
아무것도 만들 필요가 없습니다. 이는 패키지 관리자를 통해 수행됩니다.
가장 쉬운 Windows 용 Node 버전 관리자 는 nodist 입니다.
- Make sure you've uninstalled node - be sure the node folder's deleted (defaults to Program Files) and it's removed from your user and system path. Also delete the
npmandnpm-cachefolders fromC:\Users\[Username]\AppData\Roaming. git clone git://github.com/marcelklehr/nodist.gitor use the supplied .zip file if you haven't got / have no luck with git.- Add
.../nodist/binto your path nodist updateto install dependenciesnodist latestornodist add 0.10.10 && nodist 0.10.10to install and use the latest version.nodist stable, in turn, gives you the latest stable build.nodeshould enter you in interactive mode ( a>before the prompt)- If it worked, victory lap:
> console.log('YYYYYYYYYYES!')
There's also nmvw which requires Python 2.7 and git; I haven't tried it.
The easiest way to update to latest stable is using the NPM. Just execute the following:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
If you want latest possible just replace the last command with
sudo n latest
Today, there is Node.js official documentation over here. I've tried to explain simply for variety cases for Ubuntu OS the below.
Remove the current old version of Node.js by using the following code;
a. If Node.js was installed by using source code with
./configureandmake installcommands;- If the installation directory still exists;
- Enter into the node.js directory using
cdcommand likecd node-v0.12.3/ - Run the command of
sudo make uninstall
- Enter into the node.js directory using
- If the installation directory has been deleted a while ago;
- Download the source code again by using
wgetcommand like this
wget https://nodejs.org/dist/v0.12.3/node-v0.12.3.tar.gz
If you don't know the current versionnode -vcommand might be used for this. In my case version is v0.12.3 - Extract the tar file using
tar -xvf node-v0.12.3.tar.gz - Enter into the new directory using
cd node-v0.12.3 - Preparing package for the remove operation using
./configurecommand - Finally remove the installed package properly using
sudo make uninstallcommand
- Download the source code again by using
b. If Node.js was installed by using
apt-getcommand,sudo apt-get remove nodejscommand can be used to remove the current Node.js package.- If the installation directory still exists;
Install the latest version of Node.js by using as directed by the official documentation with the following commands;
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
[For now setup_5.x is the newest version]sudo apt-get install -y nodejs
And finally let's check the installation using nodejs -v.
sudo n latest/stable would not work now, as the latest is 0.8.1 which links to node-v0.8.1-RC1.tar.gz and n will look for node-v0.8.1.tar.gz, can do sudo n 0.8.0.
Its very easy. Just Install "node version manager" using command :
npm install -g n.
Then enter command:
n latest
I am assuming you have npm installed over node package. This will upgrade your node to latest version.
참고URL : https://stackoverflow.com/questions/5123533/how-can-i-uninstall-or-upgrade-my-old-node-js-version
'Program Club' 카테고리의 다른 글
| 데이터 바인딩 클래스가 생성되지 않았습니다. (0) | 2020.11.22 |
|---|---|
| try-catch보다 C #에서 URL을 확인하는 더 좋은 방법은 무엇입니까? (0) | 2020.11.22 |
| JQuery 배열에서 속성으로 객체를 찾는 방법 (0) | 2020.11.22 |
| ffmpeg 출력에서 지속 시간을 추출하는 방법은 무엇입니까? (0) | 2020.11.22 |
| Java에서 ArrayList를 Array로 변환 (0) | 2020.11.22 |