From 9c381b4469f128b31cb22dd454a32814155e3db5 Mon Sep 17 00:00:00 2001 From: Seunghyun Woo Date: Tue, 24 Mar 2026 16:38:40 +0900 Subject: [PATCH] fix: move ajv to dependencies and auto-install deps in install scripts `ajv` is required at runtime by the installer (`scripts/lib/install/config.js`) but was listed under `devDependencies`. This caused `Error: Cannot find module 'ajv'` when running `./install.sh` from a fresh git clone or via `npx`. - Move `ajv` from devDependencies to dependencies in package.json - Add auto `npm install` in install.sh when node_modules is missing - Add matching auto-install in install.ps1 for Windows parity --- install.ps1 | 9 +++++++++ install.sh | 6 ++++++ package.json | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/install.ps1 b/install.ps1 index 7a5af5bf..ea9b09c3 100644 --- a/install.ps1 +++ b/install.ps1 @@ -34,5 +34,14 @@ while ($true) { $scriptDir = Split-Path -Parent $scriptPath $installerScript = Join-Path -Path (Join-Path -Path $scriptDir -ChildPath 'scripts') -ChildPath 'install-apply.js' +# Auto-install Node dependencies when running from a git clone +$nodeModules = Join-Path -Path $scriptDir -ChildPath 'node_modules' +if (-not (Test-Path -LiteralPath $nodeModules)) { + Write-Host '[ECC] Installing dependencies...' + Push-Location $scriptDir + try { & npm install --no-audit --no-fund --loglevel=error } + finally { Pop-Location } +} + & node $installerScript @args exit $LASTEXITCODE diff --git a/install.sh b/install.sh index d0abc14f..31925dde 100755 --- a/install.sh +++ b/install.sh @@ -14,4 +14,10 @@ while [ -L "$SCRIPT_PATH" ]; do done SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)" +# Auto-install Node dependencies when running from a git clone +if [ ! -d "$SCRIPT_DIR/node_modules" ]; then + echo "[ECC] Installing dependencies..." + (cd "$SCRIPT_DIR" && npm install --no-audit --no-fund --loglevel=error) +fi + exec node "$SCRIPT_DIR/scripts/install-apply.js" "$@" diff --git a/package.json b/package.json index 5e82a1b3..b9a6ab12 100644 --- a/package.json +++ b/package.json @@ -110,11 +110,11 @@ }, "dependencies": { "@iarna/toml": "^2.2.5", + "ajv": "^8.18.0", "sql.js": "^1.14.1" }, "devDependencies": { "@eslint/js": "^9.39.2", - "ajv": "^8.18.0", "c8": "^10.1.2", "eslint": "^9.39.2", "globals": "^17.1.0",