Try   HackMD

Ubuntu 前端開發環境

tags: 前端筆記

最後更新日期: 2023-03-30

安裝 curl

通常已經有內建了,沒有內建可以用以下指令安裝。

sudo apt install curl

安裝 nvm

安裝的版本以 Github 頁面的說明為主: https://github.com/nvm-sh/nvm#installing-and-updating

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

用 nvm 安裝 node

以安裝 18.15.0 版為例:

nvm install 18.15.0

安裝的版本以官網的說明為主: https://nodejs.org/en/

用 nvm 更新 npm

nvm install-latest-npm

切換「預設( default )」 node 版本

以切換為 19.8.1 版為例:

nvm alias default 19.8.1

單次切換為特定 node 版本

以切換為 19 版為例:

nvm use 19

安裝 yarn 3.x

目前 Corepack 預設與 Node.js 一起安裝但是是選用,所以要啟用之

Node.js >=16.10

corepack enable

參考: https://yarnpkg.com/getting-started/install