顯示具有 Claude Code 標籤的文章。 顯示所有文章
顯示具有 Claude Code 標籤的文章。 顯示所有文章

2026年10月22日 星期四

Claude Code 學習筆記 : 將文件製作成網站發布到 Vercel

上週四上完 Karen 的直播課程後一直在忙, 都沒時間完成作業, 今天晚上要上第二堂課了, 趕緊來把作業寫完吧! 我已經在筆電安裝好 Vercel CLI 與 Vercel 佈署技能包 agent-skills, 參考 : 


先到 Claude Console 儀錶板查看目前的儲值餘額, 目前帳上有 9.8 美元 (上回安裝沒有進 Claude Code 啊, 奇怪哪裡用掉 0.2 美元?), 方便專案完成後計算花了多少錢 :




第一堂課的作業是用 Claude Code 將一個文件製作成網站, 並發佈到 Vercel 平台上. 

首先建立一個專案資料夾, 然後切換到此資料夾下開啟 claude : 

D:\claude_code\projects\mkdir karen_class_1 
D:\claude_code\projects\cd karen_class_1      
D:\claude_code\projects\karen_class_1\clasude 

接下來準備網站素材, 剛好我今天用 agy 製作了 11 月底京都奈良賞楓之旅的行程規劃書, 那就用這個 pdf 檔作為素材, 把這次的旅遊行程製作成一個 Web app 吧! 參考 :


這份行程規畫書我放在 GitHub :


將此 pdf 檔放在專案目錄 karen_class_1 下後在 Claude Code 輸入提示詞即可 : 

>請讀取專案資料夾下的行程規劃書 "20261123-28京都大阪奈良賞楓之旅行程規劃_v1.pdf", 根據此文件內容幫我設計一個京都大阪 6 日家族賞楓旅遊的一頁式行程網站。採用溫暖的秋日楓紅配色,包含出發倒數計時、Day 1 到 Day 6 的時間軸切換頁籤、每個景點的交通與長輩友善提示卡片,以及一個使用 LocalStorage 記錄勾選狀態的行前打包清單,介面需針對手機瀏覽最佳化。




然後 Claude 就開始進行讀檔與網頁設計, 只用了 4 分鐘左右就完成了 :




這時專案目錄下就多了一個 index.html 檔 (因為是一頁式網頁), 點擊用瀏覽器開啟, 發現效果真不錯哩, 功能非常完整, 布局也很俐落, 可以發布到 Vercel 交差啦 :




回到 Clude Code, 直接叫它幫我佈署 :

> 請幫我佈署到 Vercel 




只花了一分鐘就搞定了 : 




點中間的預覽網址 (preview link) 會開啟瀏覽器顯示此 Web app, 但若分享給別人則會要求登入 Vercel, 因為這是非正式網址, Vercel 專案預設開啟了部署保護機制, 必須登入開發者的 Vercel 帳號才能看到網站. 

取得正式網址須進入 Vercel 儀錶板後點擊專案 :





在 Domain 項目下就可以找到正式網址了 :





哇, 網頁品質超讚! Claude 實在太厲害啦! 這在 AI 以前恐怕要花前端工程師好幾天才弄得出來吧? 完成作業後再去察看儲值餘額, 剩下 $8.59 美元 : 




花了 9.8-8.95=0.85美元=27.2台幣, 以前這種網頁設計如果外包, 起碼要 5000 元起跳吧? 現在只花 27 元, 五分鐘不到就搞定, AI 時代無疑是新的工業革命. 

2026年10月16日 星期五

Claude Code 學習筆記 : 安裝 Vercel CLI 與部署技能包

昨天上 Karen 老師的 Vibe coding 實作課, 需註冊 Vercel 帳號, 安裝 Vercel CLI 與 Vercel 部署技能包, 這樣在 Claude Code 裡就能用提示詞例如「幫我把網站部署到 Vercel」自動執行 vercel 指令直接把檔案打包上傳到 Vercel 雲端平台. 


1. 註冊 Vercel 帳號 : 

到 Vercel 官網 : 


按右上角的 SIGN UP 鈕 : 




可以用 Google 或 GitHub 等帳號快速註冊, 但我習慣用 Email : 




輸入 Email 按 Continue with Email :



這時要去收信, 取得驗證碼 :




填入驗證碼 :




勾選 I'm working on personal projects, 隨便填一個 Team name 按 Continue :




註冊完成後按右上角頭像就可以看到帳戶名稱 (username) :




帳戶名稱會出現在網址中, 可以按名稱右邊的齒輪鈕進入設定頁面修改, 我將後面的 -5388 去掉以減少網址長度 (只要沒被別人用走即可) :




接下來在 PS 視窗輸入 vercel login 指令來登入, 它會開啟瀏覽器, 選擇登入方式, 我使用 Email, 輸入後按 Continue with Email :




這時要去信箱收驗證信, 將驗證碼輸入到網頁 :





這時會顯示授權此裝置存取 Vercel 的頁面, 按底下 Allow Access 鈕 : 




授權成功即可關掉頁面 : 



2. 安裝 Vercel CLI : 

這是 Claude Code 與 Vercel 溝通的管道, 是實際執行部署的命令列工具, 全域安裝指令如下 :

PS C:\Users\tony1> npm install -g vercel   
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: '@renovatebot/pep440@4.2.1',
npm warn EBADENGINE   required: { node: '^20.9.0 || ^22.11.0 || ^24', pnpm: '^10.0.0' },
npm warn EBADENGINE   current: { node: 'v25.2.1', npm: '11.13.0' }
npm warn EBADENGINE }

added 285 packages in 2m

可見 Vercel CLI 已安裝成功 (那些 npm warn EBADENGINE 警告與功能無關, 可以直接忽略). 開啟一個新的 PS 視窗, 檢視版本 :

PS C:\Users\tony1> vercel --version 
Vercel CLI 64.2.0
64.2.0

用 vercel login 指令登入 : 

PS C:\Users\tony1> vercel login    
Vercel CLI 64.2.0 (Node.js 25.2.1)
>
  Visit https://vercel.com/oauth/device?user_code=PSGC-KMFK

  Congratulations! You are now signed in.

  To deploy something, run `vercel`.
  To set up the Vercel plugin and connect your coding agents to the AI Gateway, run `vercel setup`.

  💡 To deploy every commit automatically,
  connect a Git Repository (vercel.link/git (https://vercel.link/git)).

這要就讓本機的命令列環境與 Claude Code 跟我們的雲端 Vercel 帳號完成免密碼安全授權綁定, Vercel CLI 已經在我們的電腦裡產生並儲存了一組專屬的登入憑證 (token), 之後不需要再打開瀏覽器輸入驗證碼, 電腦就能直接與我們的 Vercel 帳號溝通. 


3. 安裝 Claude Code 的 Vercel 技能包 : 

此 agent-skills 技能包是給 Claude Code 看的 Vercel 部署武功秘笈, 用來教它如何將網站部署到 Vercel 平台, 安裝指令如下 :

npx skills add vercel-labs/agent-skills --all -a claude-code

PS C:\Users\tony1> npx skills add vercel-labs/agent-skills --all -a claude-code  
Need to install the following packages:
skills@1.7.2
Ok to proceed? (y) y

███████╗██╗  ██╗██╗██╗     ██╗     ███████╗
██╔════╝██║ ██╔╝██║██║     ██║     ██╔════╝
███████╗█████╔╝ ██║██║     ██║     ███████╗
╚════██║██╔═██╗ ██║██║     ██║     ╚════██║
███████║██║  ██╗██║███████╗███████╗███████║
╚══════╝╚═╝  ╚═╝╚═╝╚══════╝╚══════╝╚══════╝

T   skills
|
o  Source: https://github.com/vercel-labs/agent-skills.git
|
o  Repository cloned
|
o  Found 9 skills
|
•  Installing all 9 skills
|
•  Installing to all 79 agents

|
o  Installation Summary ---------------------------------------------------------+
|                                                                                |
|  ~\.agents\skills\vercel-composition-patterns                                  |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
|  ~\.agents\skills\deploy-to-vercel                                             |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
|  ~\.agents\skills\vercel-react-best-practices                                  |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
|  ~\.agents\skills\vercel-react-native-skills                                   |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
|  ~\.agents\skills\vercel-react-view-transitions                                |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
|  ~\.agents\skills\vercel-cli-with-tokens                                       |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
|  ~\.agents\skills\vercel-optimize                                              |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
|  ~\.agents\skills\web-design-guidelines                                        |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
|  ~\.agents\skills\writing-guidelines                                           |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more         |
|    symlink → AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +51 more  |
|                                                                                |
+--------------------------------------------------------------------------------+
|
o  Security Risk Assessments ---------------------------------------------------+
|                                                                               |
|                                 Gen               Socket            Snyk      |
|  vercel-composition-patterns    Safe              0 alerts          Low Risk  |
|  deploy-to-vercel               Safe              0 alerts          Med Risk  |
|  vercel-react-best-practices    Safe              0 alerts          Low Risk  |
|  vercel-react-native-skills     Safe              0 alerts          Low Risk  |
|  vercel-react-view-transitions  Safe              0 alerts          Low Risk  |
|  vercel-cli-with-tokens         Safe              0 alerts          Med Risk  |
|  vercel-optimize                Safe              0 alerts          Low Risk  |
|  web-design-guidelines          Safe              0 alerts          Low Risk  |
|  writing-guidelines             Safe              0 alerts          Med Risk  |
|                                                                               |
|  Details: https://skills.sh/vercel-labs/agent-skills                          |
|                                                                               |
+-------------------------------------------------------------------------------+
|
o  Installation complete

|
o  Installed 9 skills ----------------------------------------------------------------------------------------+
|                                                                                                             |
|  ✓ ~\.agents\skills\vercel-composition-patterns                                                             |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|  ✓ ~\.agents\skills\deploy-to-vercel                                                                        |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|  ✓ ~\.agents\skills\vercel-react-best-practices                                                             |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|  ✓ ~\.agents\skills\vercel-react-native-skills                                                              |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|  ✓ ~\.agents\skills\vercel-react-view-transitions                                                           |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|  ✓ ~\.agents\skills\vercel-cli-with-tokens                                                                  |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|  ✓ ~\.agents\skills\vercel-optimize                                                                         |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|  ✓ ~\.agents\skills\web-design-guidelines                                                                   |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|  ✓ ~\.agents\skills\writing-guidelines                                                                      |
|    universal: Amp, Antigravity, Antigravity CLI, Cline, Codex +18 more                                      |
|    symlinked: Claude Code, Eve, Kiro CLI                                                                    |
|    skipped: AiderDesk, AstrBot, Autohand Code CLI, Augment, IBM Bob +48 more (project directory not found)  |
|                                                                                                             |
+-------------------------------------------------------------------------------------------------------------+

|
—  Done!  Review skills before use; they run with full agent permissions.

npm notice
npm notice New minor version of npm available! 11.13.0 -> 11.21.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.21.0
npm notice To update run: npm install -g npm@11.21.0
npm notice

可見此技能包裡面的 9 個 skills 都安裝好了 (下方都有顯示 symlinked: Claude Code), 同時也自動幫 Antigravity CLI 與 Codex 等全域環境的連結都做好了. 


4. 把網站佈署到 Vercel 雲端 : 

以上把 Vercel CLI 與佈署技能包 agent-skills 安裝好後, 就可以在 Claude Code 內開發網站專案, 完成後只要用下列提示詞 Claude Code 就會將專案佈署到 Vercel 雲端 :

請把目前的網站直接部署到 Vercel 正式環境 (Production) 並給我公開網址

請用 deploy-to-vercel 技能幫我把專案部署到 Vercel 正式環境

也可以在 PS 視窗的專案目錄下, 用下列指令佈署專案 :

PS D:\claude_code\project_1>vercel --prod --yes    

注意, 以上所安裝的佈署技能包 (agent-skills) 是安裝在共用目錄 (~\.agents\skills\) 下, Vercel CLI 為全域安裝, 且登入狀態為作業系統層級, 所以不管是 Claude Code 或 Antigravity CLI, Codex 等 AI 代理都能透過它們一鍵佈署專案. 

Claude Code 學習筆記索引

去年 (2025) 年底, 明賢表弟用 Temas 遠端向我展示他如何使用 Claude Code 開發美股投資工具, 讓我大開眼界, 我也是從那時開始完全放棄手刻程式碼的堅持, 認清了在 AI Agent 洪流中, 軟體工程師的尊嚴早已貶值到一文不名, 於是開始學習 Claude Code. 但因隨後接觸 Gemini CLI, 且購買了 Google AI Pro, 所以 Claude Code 的學習就延宕至今. 

最近因為 Karen 老師的 Vibe Coding 課程要用到 Claude Code, 所以把之前相關的測試文章做成索引備查 :



~進行中~

2026年10月15日 星期四

Claude Code 學習筆記 : 用 Anthropic Console Account 驗證登入

我自從 6/4 儲值 10 美元買了 Claude API 使用量後一直沒時間做測試, 因今天晚上知識衛星花芸曦老師的 Vibe coding 課程需要用到 Claude code, 所以需要先測試看看能否使用. 參考 :


Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS D:\> cd claude_code 
PS D:\claude_code> claude  

按 Enter 用預設 Dark mode :




按向下鍵勾選 "Anthropic Console Account" 按 Enter :




這時會開啟瀏覽器顯示登入頁面, 輸入 Email 按 "使用電子郵件繼續" (Anthropic 使用 Email 寄送隨機驗證碼來登入, 不使用設定密碼) :




這時要去信箱收信, 按下信中的 Sign in 鈕 : 



這時會顯示認證碼, 記下來後回到登入頁面, 底下會出現一個輸入框, 填入此認證碼後按按 "驗證電子郵件地址" :




按 "授權" 鈕即完成帳號認證 :




關掉認證頁面即可 : 



這時 Claude code 終端機會顯示登入成功訊息, 按 Enter : 




再按 Enter :




詢問是否信任此資料夾, 選預設 1. Yes, proceed : 




這樣就可以開始使用 Claude Code 了 : 




可見預設使用 Sonnet 4.5 模型, 可以用 /model 指令切換成別的模型. 

2026年7月11日 星期六

INHON 應宏 Carbonbook 筆電維修 (五)

前一篇測試已完成 Python/Node 開發環境布建, 本篇要來安裝 AI 專案開發工具 : Claude Code 與 Antigravity CLI. 

本系列本系列之前的文章參考 :  



1. 安裝 Claude Code : 

安裝 Windows 原生 Claude Code 介面作法參考 :


其實是利用安裝 Git 時附帶的 git-bash.

先用 scoop which git 指令查找 git-bash 的位置 :

PS C:\Users\tony1> scoop which git   
~\scoop\apps\git\current\cmd\git.exe

然後設定一個環境變數在執行 cluade 指令時呼叫 git.exe, 前面代表使用者目錄的波浪符號 ~ 須置換為真正的使用者路徑 C:\Users\tony1, 並且將 git.exe 改成 git-bash.exe, 這樣 Claude Code 作為一個外部引擎去讀取環境變數時才讀得到, 完整的絕對位置如下 : 

C:\Users\tony1\scoop\apps\git\current\cmd\git.exe

用下列指令新增一個使用者環境變數 CLAUDE_CODE_GIT_BASH_PATH

PS C:\Users\tony1> [Environment]::SetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "C:\Users\tony1\scoop\apps\git\current\git-bash.exe", "User")

開啟一個新的 PS 視窗用下列指令檢查環境變數是否正確 :

PS C:\Users\tony1> $env:CLAUDE_CODE_GIT_BASH_PATH   
C:\Users\tony1\scoop\apps\git\current\git-bash.exe

安裝 Windows 原生版的 Claude Code : 

PS C:\Users\tony1> irm https://claude.ai/install.ps1 | iex   
Setting up Claude Code...

√ Claude Code successfully installed!

  Version: 2.1.206

  Location: C:\Users\tony1\.local\bin\claude.exe


  Next: Run claude --help to get started

‼ Setup notes:
  ●Native installation exists but C:\Users\tony1\.local\bin is not in your PATH. Add it by opening: System
    Properties →Environment Variables →Edit User PATH →New →Add the path above. Then restart your
    terminal.


✅ Installation complete!

安裝完成後須將 Claude Code 的執行檔目錄路徑加入使用者環境變數 Path 中, 這樣以後才能在任何路徑下執行 Claude Code, 可用下面兩個 PS 指令設定 : 

PS C:\Users\tony1> $oldPath = [Environment]::GetEnvironmentVariable("PATH", "User")  
PS C:\Users\tony1> [Environment]::SetEnvironmentVariable("PATH", "$oldPath;C:\Users\tony1\.local\bin", "User")

開一個新的 PS 視窗, 用下列指令檢查環境變數是否有設定進去 : 

PS C:\Users\tony1> $env:PATH -split ";"   
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\OpenSSH\
C:\Program Files\Bandizip\
C:\Users\tony1\scoop\apps\nvm\current
C:\Users\tony1\scoop\apps\nvm\current\nodejs\nodejs
C:\Users\tony1\scoop\apps\git\current\cmd
C:\Users\tony1\scoop\persist\uv\tools\shims
C:\Users\tony1\scoop\persist\uv\python\shims
C:\Users\tony1\scoop\apps\python\current\Scripts
C:\Users\tony1\scoop\apps\python\current
C:\Users\tony1\scoop\shims
C:\Users\tony1\AppData\Local\Microsoft\WindowsApps
C:\Users\tony1\.local\bin

輸入 claude 按 Enter 啟動 Claude Code 介面 :

PS C:\Users\tony1> claude   
Welcome to Claude Code v2.1.206

 Let's get started.

 Choose the text style that looks best with your terminal
 To change this later, run /theme

   1. Auto (match terminal)
 > 2. Dark mode √
   3. Light mode
   4. Dark mode (colorblind-friendly)
   5. Light mode (colorblind-friendly)
   6. Dark mode (ANSI colors only)
   7. Light mode (ANSI colors only)

 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
  1  function greet() {
  2 -  console.log("Hello, World!");
  2 +  console.log("Hello, Claude!");
  3  }
 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
  Syntax theme: Monokai Extended (ctrl+t to disable)




這樣便完成 Claude Code 安裝了.


2. 安裝 Antigravity CLI : 

Antigravity 是 2026/6/18 之後 Google 提供給個人帳戶使用的 Coding 代理工具, 比 Gemini CLI 功能還多, 除了可以使用 Gemini 模型外也可以用 /model 指令選擇使用 Claude 或 GTP 模型, 參考 :


與 Cluade Code 類似, 谷歌提供 Windows 原生版 Antigravity CLI 安裝指令稿, 開啟 PS 視窗輸入下列指令安裝 :

PS C:\Users\tony1> irm https://antigravity.google/cli/install.ps1 | iex  
I0711 09:00:44.658613  9148 installer.go:27] Running Antigravity CLI setup...
I0711 09:00:44.827074  9148 installer_windows.go:45] Configuring Windows user PATH registry environment...
I0711 09:00:44.827608  9148 installer_windows.go:117] Successfully added %LOCALAPPDATA%\agy\bin to User PATH registry variable.
I0711 09:00:44.827608  9148 installer_windows.go:148] Broadcasting environment update system-wide...
I0711 09:00:45.058274  9148 installer_windows.go:167] Environment update broadcast completed.

Warning: C:\Users\tony1\AppData\Local\agy\bin is not present in your active Environment PATH.
Please restart your active terminal session, or add it manually if needed.


✅ Antigravity CLI binary placed successfully at C:\Users\tony1\AppData\Local\agy\bin\agy.exe
Note: The binary is installed, but it is not in your active PATH. Please follow the instructions above to add it, then restart your terminal session.

開啟一個新的 PS 視窗, 輸入 agy 就可啟動 Antigravity 了 :

PS C:\Users\tony1> agy 




用 Google Auth 登入, 複製金鑰貼到 agy 即可. 

至此就完成這次的 INHON Carbonbook 的復原工程了, 4GB DRAM 跑起來還是很輕快不卡頓, 沒想到因為無法開機塵封多年後, 只是把金手指接點清潔一下就恢復生機, 真是太棒了. 

不過畢竟是超過 12 年的老機器了, 第一次重灌 Win10 後去系統資訊裡修改裝置名稱, 重開機後網路卡介面居然消失無法連網, Gemini 提供了好幾招都無法喚回, 只好再次重灌, 結果仍然無法找回網路卡, 應該是網卡 GG 了, 只好插一顆 USB 網卡來上網. 這台筆電因為性能較最近修好的其他兩台好,所以會定位在備用機而非下載機. 

2026年6月18日 星期四

MSI 電競桌機維修 (五)

前一篇我已安裝好 Scoop 工具並用它來安裝系統全域 Python 執行環境, 管理虛擬環境與專案的 uv 工具, Git 與 nvm 以及 Node.js, 本篇要在此基礎上安裝  Claude Code 與 Gemini CLI. 

本系列之前的文章參考 :



1. 安裝 Claude Code : 

在 Windows 上可以安裝原生版 Claude Code 軟體並使用 Git 附帶的 git-bash 指令列作為介面, 參考 :


在前一篇測試中已用 Scoop 安裝了 git, 在安裝原生版 Claude Code 之前必須先把 git-bash 的程式位置設在特定的使用者環境變數 CLAUDE_CODE_GIT_BASH_PATH 中, Claude Code 會固定找尋此環境變數來取得 git-bash 程式位置. 

我照之前做法用 where.exe 查詢 git-bash 程式的位置 : 

PS C:\WINDOWS\System32> where.exe bash   
資訊: 找不到提供模式的檔案。

詢問 Gemini 原因, 原來是 Scoop 還沒幫 git-bash 生成墊片 (Shim), 因為 Scoop 預設只會幫該軟體的核心指令建立墊片, 而 git-bash.exe 或 bash.exe 這種附屬的小工具, Scoop 預設不會把它們放進全域的 shims 資料夾裡, where.exe 是一個很笨的工具, 它只會去 Windows 系統的 PATH 捷徑資料夾裡撈東西, 既然 Scoop 預設沒有幫 git-bash.exe 建立全域捷徑, where.exe 自然就回報找不到. 

其實用 scoop which git 指令就可以查到 git 的位置了 :

PS C:\WINDOWS\System32> scoop which git   
~\scoop\apps\git\current\cmd\git.exe

注意, 這位置開頭的波浪 ~ 雖然在 Power Shell 視窗可以被辨識 (代表我的使用者目錄 : C:\Users\tony1), 但 Claude Code 作為一個外部引擎去讀取環境變數時可能會看不懂, 必須置換為使用者路徑, 並且將 git.exe 改成 git-bash.exe, 完整的絕對位置如下 : 

C:\Users\tony1\scoop\apps\git\current\cmd\git-bash.exe  

接下來可以像之前的做法那樣, 手動到系統設定中新增一個使用者環境變數 CLAUDE_CODE_GIT_BASH_PATH 並設為此位置設定, 也可以用下列 PS 指令一鍵完成設定 : 

PS C:\WINDOWS\System32> [Environment]::SetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "C:\Users\tony1\scoop\apps\git\current\git-bash.exe", "User") 

設定好後關閉 PS 視窗重開新的, 用下列指令檢查環境變數是否正確 : 

PS C:\WINDOWS\System32> $env:CLAUDE_CODE_GIT_BASH_PATH   
C:\Users\tony1\scoop\apps\git\current\git-bash.exe

這樣便可以在新開的 PS 視窗安裝 Windows 原生版的 Claude Code 了 : 

PS C:\WINDOWS\System32> irm https://claude.ai/install.ps1 | iex  
Setting up Claude Code...

√ Claude Code successfully installed!

  Version: 2.1.179

  Location: C:\Users\tony1\.local\bin\claude.exe


  Next: Run claude --help to get started

‼ Setup notes:
  ● Native installation exists but C:\Users\tony1\.local\bin is not in your PATH. Add it by opening: System Properties →
    Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.


✅ Installation complete!

版本已經來到 v2.1.179 了. 請注意在 Setup notes 中有提醒要將 Claude Code 的執行檔目錄路徑加入使用者環境變數 Path 中, 這樣以後才能在任何路徑下執行 Claude Code. 

當然可以到系統設定中手動將 C:\Users\tony1\.local\bin 加到 使用者環境變數 Path 的最後面, 也可以用下面兩個 PS 指令設定 : 

PS C:\WINDOWS\System32> $oldPath = [Environment]::GetEnvironmentVariable("PATH", "User")

這指令是抓取目前登入使用者 (tony1) 現有的 User PATH 設定後儲存在 $oldPath 變數中. 

PS C:\WINDOWS\System32> [Environment]::SetEnvironmentVariable("PATH", "$oldPath;C:\Users\tony1\.local\bin", "User")   

第二個指令是把新路徑接到舊路徑後面 (用分號隔開) 並寫回 Windows 系統的使用者環境變數 Path 中. 

檢查環境變數異動須重開一個 PS 視窗, 輸入下列指令 :

PS C:\WINDOWS\System32> $env:PATH -split ";"   
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\NVIDIA Corporation\NVIDIA App\NvDLISR
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Users\tony1\scoop\apps\nvm\current
C:\Users\tony1\scoop\apps\nvm\current\nodejs\nodejs
C:\Users\tony1\scoop\apps\git\current\cmd
C:\Users\tony1\scoop\persist\uv\tools\shims
C:\Users\tony1\scoop\persist\uv\python\shims
C:\Users\tony1\scoop\apps\python\current\Scripts
C:\Users\tony1\scoop\apps\python\current
C:\Users\tony1\scoop\shims
C:\Users\tony1\AppData\Local\Microsoft\WindowsApps
C:\Users\tony1\.local\bin

最後一個便是 Claude Code 的執行檔目錄位置. 

輸入 claude 按 Enter 出現如下畫面 :




這樣便完成 Claude Code 的安裝了. 接下來安裝 Gemini CLI. 


2. 用 npm 安裝 Gemini CLI : 

我們在前一篇測試中已安裝好 Node.js, 接下來參考之前的作法, 在 PS 視窗輸入下列 npm 指令安裝 Gemini CLI :

PS C:\WINDOWS\System32> npm install -g @google/gemini-cli   

changed 7 packages in 2s
npm warn allow-scripts 2 packages have install scripts not yet covered by allowScripts:
npm warn allow-scripts   @github/keytar@7.10.6 (install: node script/install.js || npm run build)
npm warn allow-scripts   node-pty@1.1.0 (install: node scripts/prebuild.js || node-gyp rebuild; postinstall: node scripts/post-install.js)
npm warn allow-scripts
npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review, or `npm approve-scripts <pkg>` to allow.

出現警告而未能安裝 Gemini CLI, 我將上面訊息貼給 Gemini, 原來 @google/gemini-cli 這個工具為了能在終端機裡呈現帥氣的互動介面需依賴兩個非常硬核的底層套件 : 
  • node-pty : 負責模擬 Linux/Unix 終端機介面.
  • @github/keytar : 負責安全地把 Google API Key 存進 Windows 的憑證保險箱. 
在安裝 @google/gemini-cli 時, 它會執行編譯腳本動作, 將此二套件的 C++ 程式碼編譯成 Windows 的二進位檔, 新版的 npm 為了防止惡意軟體偷偷在背後跑腳本, 預設會攔截這些行為跳出警告. 

要解除此攔截需先用下列指令修改 npm 的全域設定, 強迫允許執行腳本 : 

PS C:\WINDOWS\System32> npm config set ignore-scripts false --global   

然後用下列指令 --foreground-scripts 參數繞過權限管理員, 強迫 Windows 彈出編譯視窗, 直接在最前面把 node-pty 和 keytar 編譯出來後, 直接進行全域強制覆蓋安裝 : 

PS C:\WINDOWS\System32> npm install -g @google/gemini-cli --foreground-scripts  

> @github/keytar@7.10.6 install
> node script/install.js || npm run build


> node-pty@1.1.0 install
> node scripts/prebuild.js || node-gyp rebuild

> Checking prebuilds...

> node-pty@1.1.0 postinstall
> node scripts/post-install.js

> Cleaning release folder...
> Moving conpty.dll...
  Using os.arch(): x64
  Found version 1.23.251008001
  Copying C:\Users\tony1\scoop\persist\nvm\nodejs\v26.3.0\node_modules\@google\gemini-cli\node_modules\node-pty\third_party\conpty\1.23.251008001\win10-x64\conpty.dll -> C:\Users\tony1\scoop\persist\nvm\nodejs\v26.3.0\node_modules\@google\gemini-cli\node_modules\node-pty\build\Release\conpty\conpty.dll
  Copying C:\Users\tony1\scoop\persist\nvm\nodejs\v26.3.0\node_modules\@google\gemini-cli\node_modules\node-pty\third_party\conpty\1.23.251008001\win10-x64\OpenConsole.exe -> C:\Users\tony1\scoop\persist\nvm\nodejs\v26.3.0\node_modules\@google\gemini-cli\node_modules\node-pty\build\Release\conpty\OpenConsole.exe

changed 7 packages in 2s
npm warn allow-scripts 2 packages have install scripts not yet covered by allowScripts:
npm warn allow-scripts   @github/keytar@7.10.6 (install: node script/install.js || npm run build)
npm warn allow-scripts   node-pty@1.1.0 (install: node scripts/prebuild.js || node-gyp rebuild; postinstall: node scripts/post-install.js)
npm warn allow-scripts
npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review, or `npm approve-scripts <pkg>` to allow.

雖然新版 npm 仍然頑固地跳出 npm warn allow-scripts 警告, 但 Gemini CLI 已經安裝成功了 (黃底色部分顯示 node-pty 最核心的底層微軟虛擬終端組件 conpty.dll 和 OpenConsole.exe 已經成功複製, 編譯與就位了), 這樣便可將上面強迫允許執行腳本的 npm 全域設定復原了 : 

PS C:\WINDOWS\System32> npm config delete ignore-scripts --global   

關閉 PS 視窗重開一個, 輸入 gemini 按 Enter 出現如下畫面表示 Gemini CLI 已經安裝成功了 : 




2026-07-10 補充 :

谷歌已自 6/18 起停止個人帳戶使用 Gemini CLI (企業用戶可繼續使用), 個人戶要改用 Antigravity CLI, 參考 :


2026年6月4日 星期四

Claude Code 學習筆記 : 儲值與建立 API 金鑰

最近幾天因為 MSI 電競主機故障待修, 於是轉而閱讀阿亮老師的大作 "養成你的 AI 龍蝦管家", 書中介紹三大 AI 自主代理平台 (三王工具) : 
  • Goolge Antigravity
  • Claude Code
  • OpenClaw
Google Antigravity 是一個多 Agent, 可預覽測試網頁的可視化 AI 程式開發工具; Claude Code 是終端機特助, 可用來管理專案資料夾, 進行 Git 版本控制與微調設定檔等. OpenClaw 則是一個能透過多通道 (LINE, Telegram) 自主完成任務的 AI 管家 (秘書), 有了 Antigravity 與 Claude Code 幫助, 才能充分發揮 OpenClaw 功能. 

本來打算先學完 Gemini CLI 後再來付月費學 Claude Code, 但看了阿亮老師的書發現其實可以先用 Pay As You Go 方式儲值購買 API 使用額度 (credits) 來用, 反正只是測試學習又不是做大專案, 吃 token 不會太兇, 不夠再除值即可. 

本系列前一篇文章參考 :


我在 2023 年就已註冊 Claude AI 帳號, 所以只要到 Anthropic Console 網站登入即可 :


我使用 Hinet 信箱登入, Claude 帳號不使用密碼, 而是每次登入都將認證碼寄到信箱 : 




到信箱收取認證碼, 填入後按 Verify Email address 鈕 :




登入成功後會轉至 Dashboard 頁面, 按 Add Fund 即可儲值 :




既定金額有 20, 100, 500 美元, 想儲其它金額例如 10 美元可按右邊的 Others :





輸入 10 美元, 填寫 Billling Address 的欄位 (例如全名, 國家, 郵遞區號等) 與信用卡資訊 (JCB 卡較不容易通過綁定, 建議用 VISA 或 MASTER) :




雖然資料都有填好 (Business tax ID 統編欄位不要填), 但底下 tax 與 total due 無資料, "Buy USD 10 of credits" 鈕是灰色無法按 :




我問 Gemini 原因, 它認為是 Anthropic 的前端對台灣這個國家的地址/稅率判定卡住了, 建議改選美國, 例如免消費稅的奧勒岡州 (Oregon), 城市填 Portlan (郵遞區號 97201), 街道地址可填 1234 SW Morrison St., 這樣就能通過檢查, 底下的購買鈕變成黑色可按 : 





按購買鈕後會出現詢問是否要自動儲值 (Auto-reload), 按底下的 Skip for now 鈕跳過 :





這樣便完成儲值程序, 按 Create API Key 建立金鑰 :




這兩個 2024 年測試用的金鑰應該已過時可刪除, 按 Create Key 鈕新增 :




選擇 Workspace 輸入 Name, 按 Add 鈕新增 :




先按 Copy key 鈕複製金鑰, 儲存到檔案 (例如 .env) 後按 Done 即可 : 





回 Dashboard 確認已儲值 10 美元無誤 :