在Ubuntu上配置Node.js环境可以通过以下几种方法:
sudo apt update sudo apt install curl -y curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - 这里的16.x是你想要安装的Node.js版本号,可以根据需要更改。
sudo apt install nodejs node -v npm -v curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash source ~/.bashrc nvm install 16.14.0 node -v npm -v sudo apt update sudo apt install nodejs npm node -v npm -v