Contents

ubuntu 18.04 安装 nodejs 以及 yarn

Contents
  • cd ~
  • curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh *ps 可以更改以上语句中的数字 ‘_12’ 即可安装其他版本.
  • 该语句运行完会提示以下内容, 根据需求执行命令即可.
## Run `sudo apt-get install -y nodejs` to install Node.js 12.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL 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-get update && sudo apt-get install yarn