mynote/nodejs/install.md
2024-04-06 23:33:19 +08:00

987 B

install nodejs npm

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