Programming

NPM을 업데이트하는 방법

procodes 2020. 7. 19. 16:00
반응형

NPM을 업데이트하는 방법


mean.io 상용구를 설치하려고합니다. 실행할 때 실패합니다 sudo npm install -g meanio@latest. 실패하기 전에 npm 버전 1.4.x를 '원합니다'.1.2.18이 설치되어 있습니다. 그래서 npm을 최신으로 업데이트하려고 시도했습니다. 몇 가지 방법들. 마지막은 ...

ubuntu@ip-xxx-xx-xx-xxx:~$ sudo npm install -g npm
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@1.4.7 /usr/local/lib/node_modules/npm

ubuntu@ip-xxx-xx-xx-xxx:~$ npm --version
1.2.18

방금 1.4.7로 업데이트했는데 왜 버전 1.2.18이 표시됩니까?


이 업데이트됩니다 NPM 사용하여 NPM 자체를 :

sudo npm install npm -g

붙어 있으면 시도하십시오 sudo npm update npm -g. 모든 크레딧은 Tim Castelijns에게 전달됩니다. 나는 한 우분투 14.04에 그것을 테스트, NPM 1.3.10


예를 들어 테스트 목적으로 로컬 개발 환경에서 여러 버전관리하기 위해 nvm사용하는 경우 설치된 모든 버전 (으로 나열 )은 ~ / .nvm에 있으므로 시스템 전체 설치는 생략합니다 (예 : sudo 생략).nvm ls

npm install npm -g

데비안 엔터프라이즈

완전한 엔터프라이즈 실습을 위해서는 nodesource.com을 고려 하십시오

curl -sL https://deb.nodesource.com/setup | sudo bash-

여기에 설명 된대로 .

다른 기업

비 데비안 배포판의 경우 노드 github wiki https://github.com/joyent/node/wiki/installing-node.js-via-package-manager 다운로드 페이지 https://nodejs.org/en/download에서 확인하십시오. /

역사적 이해 : Chis Lea는 자신의 PPA를 유지하고 있었지만 이제는 nodesource합쳤습니다 .


user3223763의 답변이 작동하지 않으면 다음을 시도하십시오.

sudo apt-get remove nodejs ^node-* nodejs-*
sudo apt-get autoremove
sudo apt-get clean
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs

그런 다음 :

curl https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | sh

그런 다음 새 터미널을 열고 npm 버전을 확인하십시오.

npm --version

편집 / 업데이트 :

현재 마지막 nvm 버전은 다음과 같습니다.

https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh

따라서 CURL 명령은 다음과 같습니다. v0.13.1 대신 v0.25.4

curl https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | sh

https://github.com/creationix/nvm/releases확인 하여 추가 업그레이드에 올바른 버전을 사용할 수 있습니다


명령 줄에서 우분투를 사용하고있는 것 같습니다. PPA 저장소 를 업데이트 npm하고 nodejs사용할 수 있습니다.

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm

터미널 창을 닫았다가 다시 시작하는 것을 잊지 마십시오.)

(적어도 터미널에서 "npm --version"을 확인하려는 경우)

sudo npm install npm -g

저도 그 트릭을 했어


Ubuntu 14.04에서 위의 옵션을 시도했지만 지속적 으로이 오류가 발생합니다.

npm ERR! tar pack /root/tmp/npm-15864/1465947804069-0.4854120113886893/package 읽기 오류

그런 다음이 솔루션을 온라인에서 찾았습니다.

1) 먼저 npm 캐시를 정리하십시오.

sudo npm cache clean -f

2) npm의 n 모듈을 설치하십시오 .

sudo npm install -g n

3) 설치할 노드의 버전을 선택하여 설치를 시작하십시오 : 안정 또는 최신 , 여기서는 안정 을 사용 합니다 :

sudo n stable

4) 노드 버전을 확인하십시오.

node -v

5) npm 버전을 확인하십시오.

npm -v

최신 안정 버전을 실행하려면

npm install npm@latest -g

그것은 나를 위해 잘 작동했습니다!


당신은 시도 할 수 있습니다:

sudo npm i -g npm

nodejs v0.12.7로 업그레이드

 # Note the new setup script name for Node.js v0.12
 curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -

 # Then install with:
 sudo apt-get install -y nodejs

nodesource.com의 출처


나를 위해 다음 명령으로 작업했습니다.

  1. $curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  2. $apt install nodejs

Refer : https://linuxhint.com/how-to-update-npm-packages/


npm i -g npm

      Update available 4.5.0 → 4.6.1    │
   │     Run npm i -g npm to update 

this is what npm recommends when in terminal, second piece is directly copied and pasted from my terminal

note: im using a mac


In case you want to update npm to a specific version, you can use this :

npm install npm@version-number


Check your node version node -v and your npm version npm -v Then To update your npm, type this into your terminal: npm install npm@latest -g

Hope I could help. Regards


This is what worked for me on ubuntu curl -L https://www.npmjs.com/install.sh | sh


Check your node version node -v and your npm version npm -v Then To update your npm, type this into your terminal : sudo npm install npm@latest -g

N.B: Debian Based OS{ubuntu or Linux mint}


nvm install-latest-npm

if you happen to use nvm


For Ubuntu 18.04

npm install latest-version

I hope its for you also


NPM was returning the old version after running $ sudo npm install npm -g.

Restarting the terminal (i.e. close and open again) fixed the issue for me and $ npm --version began returning the expected version.

* @Rimian mentions the need to reload the terminal in a comment of another answer.

참고URL : https://stackoverflow.com/questions/23393707/how-to-update-npm

반응형