[GH-ISSUE #293] windows运行install-and-run.bat文件会报错,做了调整仅供参考 #208

Closed
opened 2026-02-27 07:18:29 +03:00 by kerem · 2 comments
Owner

Originally created by @91fapiao-cn on GitHub (Jan 30, 2026).
Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/293

windows运行install-and-run.bat文件会报错,做了调整仅供参考

`@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion

:: Process parameters
set FORCE_PULL=0

for %%a in (%*) do (
if "%%a"=="--pull" set FORCE_PULL=1
)

echo ========================================
echo AI Client 2 API Quick Install Script
echo ========================================
echo.

:: Check Git and try to pull
if !FORCE_PULL! equ 1 (
echo [Update] Pulling latest code from remote repository...
git --version >nul 2>&1
if !errorlevel! equ 0 (
git pull
if !errorlevel! neq 0 (
echo [Warning] Git pull failed, please check network or handle conflicts manually.
) else (
echo [Success] Code updated.
)
) else (
echo [Warning] Git not detected, skipping code pull.
)
)

:: Check if Node.js is installed
echo [Check] Checking if Node.js is installed...
node --version >nul 2>&1
if !errorlevel! neq 0 (
echo [Error] Node.js not detected, please install Node.js first
echo Download: https://nodejs.org/
echo Tip: Recommend installing LTS version
pause
exit /b 1
)

:: Get Node.js version
for /f "tokens=*" %%i in ('node --version') do set NODE_VERSION=%%i
echo [Success] Node.js installed, version: !NODE_VERSION!

:: Check if package.json exists
if not exist "package.json" (
echo [Error] package.json file not found
echo Please run this script in the project root directory
pause
exit /b 1
)

echo [Success] Found package.json file

echo [Install] Installing/updating dependencies...
echo This may take a few minutes, please wait...
echo Running: npm install...
:: Use npm install with timeout
call npm install --timeout=300000
if !errorlevel! neq 0 (
echo [Error] Dependency installation failed
echo Please check network connection or manually run 'npm install'
pause
exit /b 1
)
echo [Success] Dependencies installed/updated

:: Check if src directory and master.js exist
if not exist "src\core\master.js" (
echo [Error] src\core\master.js file not found
pause
exit /b 1
)

echo [Success] Project files check complete

:: Start application
echo.
echo ========================================
echo Starting AIClient2API Server...
echo ========================================
echo.
echo Server will start at http://localhost:3000
echo Visit http://localhost:3000 to view management interface
echo Press Ctrl+C to stop server
echo.

:: Start server
node src\core\master.js
`

Originally created by @91fapiao-cn on GitHub (Jan 30, 2026). Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/293 windows运行install-and-run.bat文件会报错,做了调整仅供参考 `@echo off chcp 65001 >nul setlocal enabledelayedexpansion :: Process parameters set FORCE_PULL=0 for %%a in (%*) do ( if "%%a"=="--pull" set FORCE_PULL=1 ) echo ======================================== echo AI Client 2 API Quick Install Script echo ======================================== echo. :: Check Git and try to pull if !FORCE_PULL! equ 1 ( echo [Update] Pulling latest code from remote repository... git --version >nul 2>&1 if !errorlevel! equ 0 ( git pull if !errorlevel! neq 0 ( echo [Warning] Git pull failed, please check network or handle conflicts manually. ) else ( echo [Success] Code updated. ) ) else ( echo [Warning] Git not detected, skipping code pull. ) ) :: Check if Node.js is installed echo [Check] Checking if Node.js is installed... node --version >nul 2>&1 if !errorlevel! neq 0 ( echo [Error] Node.js not detected, please install Node.js first echo Download: https://nodejs.org/ echo Tip: Recommend installing LTS version pause exit /b 1 ) :: Get Node.js version for /f "tokens=*" %%i in ('node --version') do set NODE_VERSION=%%i echo [Success] Node.js installed, version: !NODE_VERSION! :: Check if package.json exists if not exist "package.json" ( echo [Error] package.json file not found echo Please run this script in the project root directory pause exit /b 1 ) echo [Success] Found package.json file echo [Install] Installing/updating dependencies... echo This may take a few minutes, please wait... echo Running: npm install... :: Use npm install with timeout call npm install --timeout=300000 if !errorlevel! neq 0 ( echo [Error] Dependency installation failed echo Please check network connection or manually run 'npm install' pause exit /b 1 ) echo [Success] Dependencies installed/updated :: Check if src directory and master.js exist if not exist "src\core\master.js" ( echo [Error] src\core\master.js file not found pause exit /b 1 ) echo [Success] Project files check complete :: Start application echo. echo ======================================== echo Starting AIClient2API Server... echo ======================================== echo. echo Server will start at http://localhost:3000 echo Visit http://localhost:3000 to view management interface echo Press Ctrl+C to stop server echo. :: Start server node src\core\master.js `
kerem closed this issue 2026-02-27 07:18:29 +03:00
Author
Owner

@justlovemaki commented on GitHub (Jan 30, 2026):

报错贴出来看看

<!-- gh-comment-id:3824561405 --> @justlovemaki commented on GitHub (Jan 30, 2026): 报错贴出来看看
Author
Owner

@91fapiao-cn commented on GitHub (Feb 2, 2026):

PS D:\AIClient-2-API-main> .\install-and-run.bat
读取或写入历史记录文件“C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt”时出错: 对路径的访问被拒绝。
ưm'vel!' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

<!-- gh-comment-id:3834644629 --> @91fapiao-cn commented on GitHub (Feb 2, 2026): PS D:\AIClient-2-API-main> .\install-and-run.bat 读取或写入历史记录文件“C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt”时出错: 对路径的访问被拒绝。 ưm'vel!' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#208
No description provided.