Uyifaka njani iNode.js kunye npm kwiDebian 10

Ibhlog

Uyifaka njani iNode.js kunye npm kwiDebian 10

Uyifaka njani iNode.js kunye npm kwiDebian 10

Isiqulatho

Faka iNode.js kunye npm kwiDebian 10

Kolu qeqesho, siza kufunda indlela yokufaka i-Node.js nge-npm kwi-Debian 10. I-Node.js yindawo evulekileyo yeJavaScript yexesha lokuSebenza kwenkqubo esecaleni ye-JavaScript. I-Node.js eyakhiwe kwi-Chrome ye-V8 JavaScript injini ukuze isetyenziselwe ukwakha iintlobo ezahlukeneyo zezicelo ezisecaleni kweseva.

Apho npm imele iNode Package Manager engumphathi weephakheji emiselweyo yeNode.js. npm yeyona rejista inkulu yesoftware yeepakethi zeNode.js ngamawaka eephakeji ezikhoyo.

Kule tutorial siza kufaka i-Node.js ngokulandela iindlela ezimbini:

  1. Faka iNode.js kunye npm usebenzisa indawo yokugcina yeDebian
  2. Faka iNode.js kunye npm usebenzisa i-nvm
  3. Faka iNode.js kwindawo yokugcina izinto zeNodeSource.

1.Faka iNode.js kunye npm usebenzisa indawo yokugcina yeDebian

Okokuqala, Hlaziya i-Debian apt index index ye-package ngokwenza lo mthetho ulandelayo.

/ Java funda ifayile ye-csv kuludwe
sudo apt update

Faka iNode.js kwindawo yokugcina izinto zeDebian ngokuchwetheza

sudo apt install node

Qinisekisa ukufakwa kweNode.js ngokuchwetheza

node --version

Faka npm ngokulandela lo myalelo ulandelayo

sudo apt install npm

Qinisekisa ukufakwa kuka-npm ngokuchwetheza

npm --version

2.Faka iNode.js kunye npm usebenzisa i-nvm

I-NVM imele iNode Version Manager esetyenziselwa ukulawula iinguqulelo ezininzi zeNode. Ukuba ufuna ukufaka okanye ukukhipha iinguqulelo ezahlukeneyo zeNode.js emva koko i-NVM ikho.

Okokuqala, siya kufaka i-NVM (Umphathi wePakethe yeNode) kwinkqubo yakho. Khuphela iskripthi sokufaka i-NVM sisebenzisa lo myalelo ulandelayo.

I-bitbucket ibuyisa isebe elisusiweyo
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Jonga uguqulelo lwe-nvm kwaye uqinisekise ukufakwa kokuchwetheza

node --version

Ngoku faka iNode.js ngokusebenzisa lo myalelo ulandelayo.

ulawulo lolawulo lokubhalwa kwe studio
nvm install node

Qinisekisa ukufakwa kweNode.js ngokuchwetheza

node --version

Iziphumo kufuneka zibe:

Iziphumo

v10.14.0

Ungafaka iinguqulelo ezininzi zeNode. Ukwenza oku kuchwetheza oku kulandelayo:

nvm install 8.14 nvm install --lts nvm install 11.3

Ukudwelisa zonke iinguqulelo ezifakiweyo zilandela lo myalelo.

nvm ls

Ungalutshintsha uguqulelo lwangoku olungagqibekanga lweNode.js ngokusebenzisa lo myalelo ulandelayo.

nvm use 8.14

Ukukhupha uhlobo lwenguqulo yeNode

nvm uninstall 11.14

Faka iNode.js kwiNodeSource Repository

Inkampani yeNodeSource ibonelela ngenkxaso yenqanaba leshishini ikwagcina indawo yokugcina enenguqulo yeNode.js.

Ukwenza ukugcinwa kweNodeSource kwinkqubo yakho usebenzise lo myalelo ulandelayo.

Andikwazi ukungena kwi-imeyile ye-aol
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -

QAPHELA: Inguqulelo yeLTS yamva nje yeNode.js yi-10.x ukuba ufuna ukufaka inguqulelo eyi-8.x endaweni yoko buyisela setup_10.x kunye setup_8.x

Ngoku faka i-Node.

sudo apt install nodejs

Qinisekisa ukufakwa kweNode.js kunye npm usebenzisa lo myalelo ulandelayo

node --version npm --version

Faka izixhobo zoPhuculo

Ngoku fakela ezinye iipakeji eziyimfuneko kuphuhliso ngokusebenzisa lo myalelo ulandelayo

sudo apt install gcc g++ make

Uninstall Node.js kunye npm

Khipha iNode.js sebenzisa ukulandela lo myalelo

roku nge-ikhonkco
sudo apt remove nodejs npm sudo apt autoremove

Ukukhupha uguqulelo lwe-node.js usebenzisa uhlobo lwe-nvm ulandela lo myalelo

nvm uninstall 10.14

Isiphelo

Ufunde ngempumelelo indlela yokufaka i-Node.js nge-npm kwi-Debian 10. Ukuba unayo nayiphi na imibuzo ungalibali ukunika izimvo apha ngezantsi.

# node-js #nodejs #node #Debian