進入nodejs官網,選擇mac,選擇安裝方式,選擇版本即可獲得安裝命令 直接執行即可
具體腳本
# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"# Download and install Node.js:
nvm install 14# Verify the Node.js version:
node -v # Should print "v14.21.3".
nvm current # Should print "v14.21.3".# Verify npm version:
npm -v # Should print "6.14.18".
?執行后查看node版本