1.2 KiB
1.2 KiB
install nodejs npm
nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm list-remote
nvm install node
npm install --global yarn
install and update
sudo apt install nodejs
sudo apt install npm
sudo npm install n@latest -g
sudo n stable
sudo npm install npm@latest -g
node -v
npm -v
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
#or
npm config set registry https://registry.npm.taobao.org
npm config get registry
-
if error: /usr/bin/env: node: No such file or directory
ln -s /usr/bin/nodejs /usr/bin/node
-
if old nodejs still exist
sudo apt purge nodejs
node && yarn
# yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
sudo yarn global add n
sudo n stable
nvm
https://github.com/nvm-sh/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install 20
npm install --global yarn