openclaw win安装随笔记录

  1. 安装环境:node、git、npm、增加到环境变量,下面脚本保存bat后缀后运行

@echo off
echo.
echo ==============================================================================
echo  Cloud Desktop AI - Basic Environment Init
echo ==============================================================================
echo.

set "PATH=%PATH%;C:\Program Files\nodejs;%APPDATA%\npm;C:\Program Files\Git\bin;C:\Program Files\Git\cmd"

:: ========== Step 1: Node.js (v22+) ==========
where node >nul 2>nul
if %ERRORLEVEL% neq 0 (
    echo [1/5] Node.js not found, installing v22
    where winget >nul 2>nul
    if %ERRORLEVEL% equ 0 (
        call winget install OpenJS.NodeJS --version 22.16.0 --accept-source-agreements --accept-package-agreements
    ) else (
        echo Downloading Node.js 22 installer
        powershell -Command "Invoke-WebRequest -Uri 'https://nodejs.org/dist/v22.16.0/node-v22.16.0-x64.msi' -OutFile '%TEMP%\node-install.msi'"
        msiexec /i "%TEMP%\node-install.msi" /qn
        timeout /t 15 >nul
    )
    echo.
    echo Node.js installed. Restarting script with updated PATH
    start "" cmd /k "cd /d "%CD%" && "%~f0""
    timeout /t 2 >nul
    goto :eof
) else (
    for /f "tokens=*" %%i in ('node -v') do echo [1/5] Node.js %%i
)

:: ========== Step 2: npm ==========
where npm >nul 2>nul
if %ERRORLEVEL% equ 0 (
    for /f "tokens=*" %%j in ('npm -v') do echo [2/5] npm v%%j
) else (
    echo [2/5] npm not found, please reinstall Node.js
    pause
    goto :eof
)

echo.

:: ========== Step 3: Git ==========
echo [3/5] Checking Git
where git >nul 2>nul
if %ERRORLEVEL% neq 0 (
    echo       Git not found, installing
    where winget >nul 2>nul
    if %ERRORLEVEL% equ 0 (
        call winget install Git.Git --accept-source-agreements --accept-package-agreements
    ) else (
        echo       Downloading Git installer
        powershell -Command "Invoke-WebRequest -Uri 'https://registry.npmmirror.com/-/binary/git-for-windows/v2.47.1.windows.1/Git-2.47.1-64-bit.exe' -OutFile '%TEMP%\git-install.exe'"
        if exist "%TEMP%\git-install.exe" (
            start /wait "" "%TEMP%\git-install.exe" /VERYSILENT /NORESTART
        ) else (
            echo       Download failed. Please install Git manually from https://git-scm.com
        )
    )
    set "PATH=%PATH%;C:\Program Files\Git\bin;C:\Program Files\Git\cmd"
    echo       Done
) else (
    for /f "tokens=*" %%g in ('git --version') do echo       %%g
)

echo.

:: ========== Step 4: Project dependencies ==========
if exist package.json (
    echo [4/5] Installing project dependencies
    call npm install
    echo       Done
) else (
    echo [4/5] No package.json, skipped
)

echo.

echo.
echo ==============================================================================
echo  Basic environment ready
echo  Run openclaw-init.bat next to setup OpenClaw
echo ==============================================================================
echo.
pause

 

  1. 通过 NPM 全局安装 以管理员身份打开 CMD:

CMD快捷键 WIN+R,然后直接输入cmd
npm install -g openclaw@latest --registry=https://registry.npmmirror.com/
  1. 启动与配置

CMD
openclaw onboard
  • 选择QuickStart-->回车
  • 选择大模型Z.AI,(选择自己的)
  • 选择第二个
  • 输入key:XXXXXXXXXX
  • 选择模型场景
  • 选择第二个(上一个页面空格跳过)
  • 启动后也可以换成其他的大模型key
  1. 应用启动

启动命令
openclaw gateway
 
posted @ 2026-03-10 14:25  勇~勇  阅读(11)  评论(0)    收藏  举报