Node.js를 어떻게 업데이트합니까?
내 npm을 업데이트하기 위해 다음을 수행했습니다.
npm update npm -g
하지만 Node.js를 업데이트하는 방법을 모릅니다. 어떤 제안? (Node.js 0.4.1을 사용하고 있으며 Node.js 0.6.1로 업데이트하고 싶습니다.)
다른 버전의 노드를 다운로드하고 관리 할 수있는 Bash 스크립트입니다. 전체 소스 코드는 여기에 있습니다 .
Windows 용 nvm에 대한 별도의 프로젝트가 있습니다 : github.com/coreybutler/nvm-windows
다음 지침에 따라 Mac에서 Node.js 버전 0.10.6을 0.10.21로 업그레이드했습니다.
NPM의 캐시 지우기 :
sudo npm cache clean -f
'n'이라는 작은 도우미를 설치하십시오 .
sudo npm install -g n
안정적인 최신 Node.js 버전 설치
sudo n stable
또는 특정 버전을 선택하고 다음과 같이 설치하십시오.
sudo n 0.8.20
프로덕션 환경의 경우 버전 번호 지정에 주의를 기울이고 홀수 / 짝수에 대해 까다로울 수 있습니다.
크레딧
- 일반 절차 : D.Walsh
- 안정 / 불안정 버전 : P. Teixeira
업데이트 (2017 년 6 월) :
이 4 년 된 게시물은 여전히 찬성 투표를 받기 때문에 여전히 많은 사람들에게 효과가 있다고 생각합니다. 그러나 Walsh 자신은 대신 nvm 을 사용하여 Node.js 를 업데이트 할 것을 권장했습니다 .
따라서 오늘 수행 할 작업은 다음과 같습니다.
사용중인 Node.js 버전을 확인하십시오.
node --version
설치했을 수있는 Node.js 버전과 현재 사용중인 버전을 확인하십시오.
nvm ls
설치할 수있는 모든 Node.js 버전을 나열합니다.
nvm ls-remote
Windows의 경우 명령은 다음과 같습니다.
nvm ls available
설치를 위해 Node.js v8.1.0을 선택한다고 가정하면 다음을 입력하여 해당 버전을 설치합니다.
nvm install 8.1.0
그러면 설치된 Node.js 버전 중에서 자유롭게 선택할 수 있습니다. 따라서 v4.2.0과 같은 이전 버전을 사용해야하는 경우 다음과 같이 활성 버전으로 설정합니다.
nvm use 4.2
당신이있는 경우 브루는 (전용 OS X 용) 설치 :
$ brew upgrade node
Windows를 포함하여 지원되는 모든 운영 체제 *에서 작동하는 간단한 솔루션입니다 .
많은 서핑을했지만 올바른 해결책을 찾지 못한 후 Node.js 사이트로 이동하여 홈페이지 의 DOWNLOADS 버튼을 클릭 하고 설치 프로그램 (MSI)을 실행했습니다.
고맙게도 모든 것을 처리했으며 'Next'버튼을 몇 번 클릭하면 Windows 컴퓨터에서 최신 Node.js 버전이 실행됩니다.
( 원래 답변이 있습니다 )
들어 부두 노동자의 사용자, 여기에 공식적 Node.js를 이미지 .
추신 : 노드 버전을 확인하려면 npm version
또는 node --version
.
PPS : NodeJS 블로그-취약점을 주시하여 중요한 보안 릴리스를 놓치지 마십시오.
* Node.js에서 지원하는 운영 체제 : Windows , Linux , MacOS , SunOS , IBM AIX
모든 플랫폼 (Windows, Mac 및 Linux)
nodejs.org 로 이동 하여 최신 설치 프로그램을 다운로드하십시오. 제 3 자의 개입 없이는 정직하게 더 간단 할 수 없습니다. 1 분 밖에 걸리지 않으며 아무것도 다시 시작하거나 캐시를 정리할 필요가 없습니다.
이전에 npm을 통해 몇 번 수행했으며 몇 가지 문제가 발생했습니다. 예를 들어 최신 안정 릴리스를 사용하지 않는 n 패키지와 같습니다.
에 윈도우 당신이 사용할 수있는 Chocolatey를 Node.js를 (그리고 다른 패키지의 많은)를 설치하고 업데이트 할 수 있습니다.
노드 설치
cinst nodejs.install
노드 업데이트
cup nodejs.install
참고 : 사용하기 전에 당신은 Chocolatey를 설치해야합니다 cinst
및 cup
.
첫 번째 업데이트 npm
,
npm install -g npm stable
그런 다음 node
,
npm install -g node
또는 npm install -g n
버전 설치 후 확인,
node --version
또는 node -v
To control your version of Node.js, you can try n. I found it very straightforward and useful.
n is a Node.js binary management, no subshells, no profile setup, no convoluted API, just simple.
npm install -g n
n 0.6.19
will install Node.js v0.6.19.
To upgrade node to the latest version or to a specific version you can do the following:
sudo npm install n -g
sudo n 0.10.18 // This will give you the specific version
For the latest stable version:
sudo n stable
For the latest LTS version(Tested on Mac)
sudo n lts
Short & stupid answer:
Go to this page: Download | Node.js
Download the installer for your platform, then install it.
I had the same problem, when I saw that my Node.js installation is outdated.
These few lines will handle everything (for Ubuntu):
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
After this node -v
will return you the latest available version.
On CentOS 7 you can do the following:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node
node –v (Should show updated version now)
npm rebuild node-sass (Optional: if you use this)
Note: The symlink is required to link your node binary with the latest Node.js installed binary file.
For OS X, I had v5.4.1 and needed the latest version 6 so I went to the Node.js homepage and clicked on one of the links below:
I then followed the installer and then I magically had the latest version of Node.js and npm.
Some Linux distributions such as Arch Linux have Node.js in their package repositories. On such systems it is better to use a standard package update procedure, such as pacman -Suy
or analogous apt-get
or yum
commands.
As of now (Nov 2016) EPEL7 offers a pretty recent version of Node.js (6.9.1 which is an up-to-date LTS version offered on the Node.js home page). So on CentOS 7 and derivatives you can just add EPEL repository by yum install epel-release
and yum install nodejs
.
CentOS 6/EPEL6 has 0.10.x which isn't supported upstream since Oct 2016.
You may use nvm.
- Check what is the latest version at http://nodejs.org/ (e.g. v0.10.26)
- Run
nvm install v0.10.26
Done.
You can choose which version to run:
nvm ls
list the available versions and tells you which version you are using now.
nvm use VERSION
change the current node to the requested version.
nvm alias default VERSION
set the default version. The next time you source nvm.sh, this will be the version loaded (note that it doesn't change the version in use right now, run nvm use
for that).
You may use Chocolatey on Windows. It's very easy to use and useful for keeping you updated with other applications too.
Also, you can just simply download the latest version from https://nodejs.org and install it.
$ npm install -g npm stable
worked for me to update npm
Install nvm(cURL)
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
OR with Wget
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
Display list of installed versions
$ nvm ls
Display list of versions that are available to install
$ nvm ls-remote
Install your preferred version
$ nvm install v7.5.0
Set this version as the default
$ nvm alias default v7.5.0
Today I ran on a Windows Git Bash:
$ npm i node -g
and got the following output:
> node@10.6.0 preinstall C:\Users\X\AppData\Roaming\npm\node_modules\node
> node installArchSpecificPackage
+ node-win-x64@10.6.0
added 1 package and audited 1 package in 23.368s
found 0 vulnerabilities
C:\Users\X\AppData\Roaming\npm\node -> C:\Users\X\AppData\Roaming\npm\node_modules\node\bin\node
+ node@10.6.0
added 2 packages from 1 contributor in 26.089s
Read more about it at https://www.npmjs.com/package/node.
For macOS in 2018+ (as ALL of the solutions above are failing for me):
Simply go to the official nodejs site, download the official nodejs package and install it by double clicking. It's the most simple, safe and always-working thing you can do.
According to Nodejs Official Page, you can install&update new node version on windows using Chocolatey or Scoop
Using(Chocolatey):
cinst nodejs
# or for full install with npm
cinst nodejs.install
Using(Scoop):
scoop install nodejs
Also you can download the Windows Installer directly from the nodejs.org web site
The easy way to update node and npm :
npm install -g npm@latest
download the latest version of node js and update /install
For Ubuntu:
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs
Source: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
As some of you already said, the easiest way is to update Node.js through the Node.js package manager, npm. If you are a Linux (Debian-based in my case) user I would suggest to add these lines to your .bashrc
file (in home directory):
function nodejsupdate() {
ARGC=$#
version=latest
if [ $ARGC != 0 ]; then
version=$1
fi
sudo npm cache clean -f
sudo npm install -g n
sudo n $version
}
Restart your terminal after saving and write nodejsupdate
to update to the latest version of Node.js or nodejsupdate v6.0.0
(for example) to update to a specific version of Node.js.
BONUS: Update npm (add these lines to .bashrc
)
function npmupdate() {
sudo npm i npm -g
}
After restarting the terminal write npmupdate
to update your node package manager to the latest version.
Now you can update Node.js and npm through your terminal (easier).
Node.js의 버전 업데이트에 필요한 모든 것 :
$ brew install node
Homebrew 가없는 경우 ; http://brew.sh/ 로 이동하십시오 .
현재 폴더 위에 새 버전을 설치하기 만하면됩니다. Windows에서 v4.x에서 v6.10으로 업그레이드했습니다.
Windows에서는 웹 사이트에서 노드 실행 파일을 다운로드하여 설치합니다. 이것은 나를 위해 일했습니다.
npm clean cache
-캐시를 정리하는 것을 잊었습니다.npm update -g
이것은 내 Windows에서 작동하며 당신에게도 작동하기를 바랍니다 .D
Node.js를 업데이트하려면 다음을 시도하십시오.
npm update
Windows cmd 프롬프트에서.
그렇지 않으면 특정 패키지를 업데이트하려면
npm update <package_name>
예:
npm update phonegap
cmd를 열고 입력하십시오.
npm i -g npm
참고 URL : https://stackoverflow.com/questions/8191459/how-do-i-update-node-js
'your programing' 카테고리의 다른 글
UITableView 아래의 추가 구분 기호 제거 (0) | 2020.09.30 |
---|---|
JavaScript를 사용하여 URL에서 #hash를 어떻게 확인할 수 있습니까? (0) | 2020.09.29 |
Ajax 요청이 200 OK를 반환하지만 성공 대신 오류 이벤트가 발생합니다. (0) | 2020.09.29 |
venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv 등의 차이점은 무엇입니까? (0) | 2020.09.29 |
테일 콜 최적화 란? (0) | 2020.09.29 |