forked from Tomobobo710/SimpleChatJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.bat
More file actions
64 lines (58 loc) · 1.58 KB
/
Copy pathstart.bat
File metadata and controls
64 lines (58 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@echo off
echo [STARTING] SimpleChatJS...
echo Chat will be available at: http://localhost:50505
echo Browser will open automatically.
echo.
REM Check if Node.js is installed
echo Checking for Node.js installation...
where node >nul 2>&1
if errorlevel 1 (
echo.
echo [ERROR] Node.js is not installed!
echo.
echo Please download and install Node.js from:
echo https://nodejs.org
echo.
echo After installing, restart this script.
pause
exit /b 1
)
echo Node.js found!
echo.
REM Install dependencies if node_modules doesn't exist or is incomplete
if not exist "node_modules" (
echo Installing dependencies...
call npm install
if errorlevel 1 (
echo Failed to install dependencies!
pause
exit /b 1
)
echo Dependencies installed successfully!
echo.
) else (
echo Checking if all dependencies are installed...
call npm ls --depth=0 >nul 2>&1
if errorlevel 1 (
echo Missing dependencies detected, installing...
call npm install
if errorlevel 1 (
echo Failed to install dependencies!
pause
exit /b 1
)
echo Dependencies installed successfully!
echo.
) else (
echo All dependencies are present.
)
)
REM Kill any existing server on port 50505
echo Checking for existing server on port 50505...
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :50505') do (
echo Found process %%a using port 50505, killing it...
taskkill /PID %%a /F >nul 2>&1
)
REM Start the server
echo Starting server...
node backend/server.js