以前端專案來說,當不同專案使用不同的 node 版本,除了用 nvm 切換以外也可以直接用容器模式來使用 Cursor / VSCode,可以做到更好的隔離。
1. 安裝 Docker
如果 Win 環境啟用 WSL 出現錯誤,可嘗試 BIOS 模式開啟虛擬環境 (Link)
2. 在專案根目錄新增 .devcontainer 資料夾
範例
my-node-20-project/
├── .devcontainer/
Are you sure to leave this team?
Once you delete your team, all team notes will be deleted and cannot be recovered. Please ensure you've exported or transfered these notes.
Enter team name before deleting it:
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up