安装 nvm

Node.js 版本众多,nvm 可以辅助管理:

wget -qO- <https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh> | bash

网络问题可以使用代理:

用 nvm 安装 Node.js

> nvm install node                                                                             17:01:05
Downloading and installing node v16.6.1...
Downloading <https://nodejs.org/dist/v16.6.1/node-v16.6.1-linux-x64.tar.xz>...
################################################################################################################# 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v16.6.1 (npm v7.20.3)
Creating default alias: default -> node (-> v16.6.1)

安装 http 测试服务器

npm install serve -g

启动

serve

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/dc833b64-17a4-4417-b99c-9653991a0275/Untitled.png

效果

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b552ac97-05d2-409d-88cc-a8d3f762415e/Untitled.png