Node.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== Node.js == | == Node.js == | ||
== w3schools | == Install == | ||
apt install nodejs | |||
npm install -g npm | |||
npm install -g npm | |||
=== Install version 18 === | |||
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh | |||
sudo bash nodesource_setup.sh | |||
sudo apt install nodejs | |||
== Node Version Manager - nvm == | |||
NOTE: nvm does local user install only - not global | |||
Recommend using Node Version Manager <ref>https://stackoverflow.com/questions/76318653/how-can-i-install-node-js-version-18-on-ubuntu-22-04</ref> | |||
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 | |||
== 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 | |||
== w3schools == |
Revision as of 17:10, 6 July 2024
Node.js
Install
apt install nodejs
npm install -g npm
npm install -g npm
Install version 18
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh sudo bash nodesource_setup.sh sudo apt install nodejs
Node Version Manager - nvm
NOTE: nvm does local user install only - not global
Recommend using Node Version Manager [1]
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
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