Ubuntu 20.04安裝node.js和yarn

 Ubuntu 20.04安裝node.js v16和yarn

先下載v16的script並跑設定

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

參考:https://github.com/nodesource/distributions

依照script設定的建議安裝套件

sudo apt-get install -y nodejs gcc g++ make

安裝yarn

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null

echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update && sudo apt-get install yarn


2021-09-06安裝後各版本號碼如下

  • node 16.8.0
  • npm 7.21.0
  • gcc 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
  • make 4.2.1
  • yarn 1.22.5

留言