Node.js: Difference between revisions
Jump to navigation
Jump to search
Line 64: | Line 64: | ||
== w3schools == | == w3schools == | ||
== keywords == |
Revision as of 21:28, 20 September 2024
Node.js
Install
apt install nodejs
npm install -g npm
npm install -g npm
Install version 18
Install 18:
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh sudo bash nodesource_setup.sh sudo apt install nodejs
Install 20: [1]
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt install nodejs
/etc/apt/sources.list.d/nodesource.list deb [arch=amd64 signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main
Node Version Manager - nvm
NOTE: nvm does local user install only - not global
Recommend using Node Version Manager [2]
https://github.com/nvm-sh/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install 18 nvm use 18
nvm install 20 nvm use 20
Uninstall:
rm -rf .nvm # remove the lines added to .bashrc
Version
npm -V # lots of details upper case V ... usage help plus ... npm@10.7.0 /root/.nvm/versions/node/v20.15.0/lib/node_modules/npm
npm -v # upper case V 10.7.0
node -v # lower case v v20.15.0