This document explains how to build Windows packages for the S3 Migration Scheduler from source.
The project uses electron-builder to create multiple Windows package formats:
- NSIS Installer: Professional installer with shortcuts and uninstaller
- Portable Executable: Self-contained single file
- ZIP Archive: Extractable package for manual deployment
- Windows 10/11 (recommended for building)
- Node.js 18+ with npm
- Visual Studio Build Tools (for native module compilation)
- Git for source code
- PowerShell or Command Prompt
# Download from: https://nodejs.org/
# Or use Chocolatey
choco install nodejs
# Verify installation
node --version
npm --versionThis is required for compiling better-sqlite3 native module.
Option A: Visual Studio Build Tools (Recommended)
# Download from: https://visualstudio.microsoft.com/visual-cpp-build-tools/
# Install with "Desktop development with C++" workload
# Required components:
# ✅ MSVC v143 - VS 2022 C++ x64/x86 build tools
# ✅ Windows 11 SDK (latest version)
# ✅ C++ CMake tools for Visual StudioOption B: Visual Studio Community
# Download Visual Studio Community
# Install with "Desktop development with C++" workloadOption C: Chocolatey (Automated)
choco install visualstudio2022buildtools --params "--add Microsoft.VisualStudio.Workload.VCTools"# Download from: https://git-scm.com/
# Or use Chocolatey
choco install git
# Verify installation
git --versionEnable Developer Mode for code signing (avoids some build warnings):
# Settings > Update & Security > For developers > Developer mode
# Or via PowerShell (as Administrator):
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"# Clone the repository
git clone https://github.com/hndrwn-dk/s3-migration-scheduler.git
cd s3-migration-scheduler
# Check current branch
git branch# Build React frontend
cd client
npm install
npm run build
# Verify build output
dir build\
cd ..# Install server dependencies
cd server
npm install
# Test server can start (optional)
node index.js
# Press Ctrl+C to stop
cd ..# Navigate to electron app
cd electron-app
# Install dependencies (includes better-sqlite3 compilation)
npm install
# Build all Windows packages
npm run build:win
# Alternative: Build specific targets
# npm run build:win -- --win nsis # NSIS installer only
# npm run build:win -- --win portable # Portable only
# npm run build:win -- --win zip # ZIP only# Check created packages
dir dist\
# Expected output:
# S3 Migration Scheduler-1.0.0-win-x64.exe (~114MB) - NSIS Installer
# S3 Migration Scheduler-1.0.0-win-ia32.exe (~104MB) - NSIS Installer
# S3 Migration Scheduler-1.0.0-portable-x64.exe (~113MB) - Portable
# S3 Migration Scheduler-1.0.0-portable-ia32.exe (~104MB) - Portable
# S3 Migration Scheduler-1.0.0-portable.exe (~217MB) - Universal Portable
# S3 Migration Scheduler-1.0.0-win-x64.zip (~151MB) - ZIP Archive
# S3 Migration Scheduler-1.0.0-win-ia32.zip (~138MB) - ZIP Archive
# win-unpacked\ - Unpacked x64 files
# win-ia32-unpacked\ - Unpacked x86 files# Test the unpacked version first
cd "dist\win-unpacked"
& ".\S3 Migration Scheduler.exe"
# Test ZIP package
cd ..\..
Expand-Archive "dist\S3 Migration Scheduler-1.0.0-win-x64.zip" -DestinationPath "test-zip"
cd test-zip
& ".\S3 Migration Scheduler.exe"The build configuration is defined in electron-app/package.json:
{
"build": {
"win": {
"target": [
{ "target": "nsis", "arch": ["x64", "ia32"] },
{ "target": "portable", "arch": ["x64", "ia32"] },
{ "target": "zip", "arch": ["x64", "ia32"] }
],
"icon": "assets/icon.ico",
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
"publisherName": "S3 Migration Scheduler Team"
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true
}
}
}- Multi-architecture: Builds for both x64 and x86
- Native modules: Compiles
better-sqlite3for Windows - MinIO client: Includes Windows
mc.exebinary - Resource bundling: Packages server and client code
- Icon support: Uses ICO icons for Windows
- Code signing: Optional (requires certificate)
# Build only NSIS installer
npm run build:win -- --win nsis
# Build only portable executables
npm run build:win -- --win portable
# Build only ZIP archives
npm run build:win -- --win zip
# Build only x64 architecture
npm run build:win -- --x64
# Build only x86 architecture
npm run build:win -- --ia32# Build with custom app name
npm run build:win -- --config.productName="Custom S3 Migrator"
# Skip code signing (faster builds)
npm run build:win -- --config.win.sign=null
# Custom output directory
npm run build:win -- --config.directories.output=custom-dist
# Custom icon
npm run build:win -- --config.win.icon=path/to/custom.ico# Error: "gyp ERR! find VS"
# Error: "msbuild.exe failed with exit code: 1"
# Solution: Install Visual Studio Build Tools
# Download: https://visualstudio.microsoft.com/visual-cpp-build-tools/
# Install "Desktop development with C++" workload# Error: "node-gyp rebuild failed"
# Error: "error MSB8036: The Windows SDK version 10.0 was not found"
# Solution 1: Install Windows SDK
# Download latest Windows SDK from Microsoft
# Solution 2: Use different Node.js version
nvm install 18.17.0
nvm use 18.17.0
# Solution 3: Clean and rebuild
npm cache clean --force
rm -rf node_modules
npm install# Error: "icon.ico: file not found"
# Error: "Reserved header is not 0"
# Solution: Ensure valid ICO file exists
dir electron-app\assets\icon.ico
# Download valid ICO if needed (example)
# Invoke-WebRequest -Uri "https://example.com/icon.ico" -OutFile "assets\icon.ico"# Error: "cannot execute cause=exit status 2"
# Error: "A required privilege is not held by the client"
# Solution 1: Enable Developer Mode (Windows Settings)
# Solution 2: Skip code signing
npm run build:win -- --config.win.sign=null
# Solution 3: Provide signing certificate
# Set environment variables:
# $env:CSC_LINK = "path\to\certificate.p12"
# $env:CSC_KEY_PASSWORD = "certificate_password"# Error: "makensis.exe process failed"
# Error: "Plugin not found"
# Solution 1: Remove custom NSIS scripts
# Edit package.json and remove any custom "include" settings
# Solution 2: Install NSIS manually
choco install nsis# Error: "JavaScript heap out of memory"
# Solution: Increase Node.js memory limit
$env:NODE_OPTIONS = "--max-old-space-size=4096"
npm run build:win# Enable debug output
$env:DEBUG = "electron-builder"
npm run build:win
# Enable verbose logging
npm run build:win -- --publish=never --debug
# Check Electron version compatibility
npx electron --version- Type: Professional Windows installer
- Features: Desktop shortcut, Start Menu entry, Add/Remove Programs
- Installation:
C:\Program Files\S3 Migration Scheduler\ - Uninstaller: Included
- Size: ~104-114MB
- Type: Self-contained executable
- Features: No installation required, single file
- Usage: Copy and run anywhere
- Size: ~113-217MB (depending on architecture)
- Type: Compressed folder
- Features: Manual extraction and deployment
- Usage: Extract and run
S3 Migration Scheduler.exe - Size: ~138-151MB
# .github/workflows/build-windows.yml
name: Build Windows Packages
on:
push:
tags: ['v*']
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: |
npm install
cd client && npm install && npm run build && cd ..
cd server && npm install && cd ..
- name: Build Windows packages
run: |
cd electron-app
npm install
npm run build:win
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: windows-packages
path: electron-app/dist/*.exe, electron-app/dist/*.zip@echo off
REM automated-build.bat
echo Building S3 Migration Scheduler for Windows...
echo Step 1: Building frontend...
cd client
call npm install
call npm run build
cd ..
echo Step 2: Installing server dependencies...
cd server
call npm install
cd ..
echo Step 3: Building Electron packages...
cd electron-app
call npm install
call npm run build:win
echo Build complete! Check electron-app\dist\ for packages.
pause- Node.js 18+ installed and working
- Visual Studio Build Tools installed with C++ workload
- Git repository cloned
- Frontend built (
client/build/exists) - Server dependencies installed
- MinIO client (
mc.exe) present in root directory - Valid icon files in
electron-app/assets/
-
npm installcompletes without errors -
better-sqlite3compiles successfully - No NSIS script errors
- Code signing completes (or is skipped)
- All expected packages created (7 packages total)
- File sizes are reasonable (100-220MB range)
- Executables run without errors
- Installer creates shortcuts correctly
- Portable versions work from different locations
- ZIP archives extract properly
- Application starts successfully
- Backend server initializes
- Frontend loads in Electron window
- S3 connection test works
- Migration creation flow works
- Database operations function
- Logs are created properly
If all steps complete successfully, you'll have production-ready Windows packages:
electron-app/dist/
├── S3 Migration Scheduler-1.0.0-win-x64.exe # NSIS Installer (x64)
├── S3 Migration Scheduler-1.0.0-win-ia32.exe # NSIS Installer (x86)
├── S3 Migration Scheduler-1.0.0-portable-x64.exe # Portable (x64)
├── S3 Migration Scheduler-1.0.0-portable-ia32.exe # Portable (x86)
├── S3 Migration Scheduler-1.0.0-portable.exe # Portable (Universal)
├── S3 Migration Scheduler-1.0.0-win-x64.zip # ZIP Archive (x64)
├── S3 Migration Scheduler-1.0.0-win-ia32.zip # ZIP Archive (x86)
├── win-unpacked/ # Unpacked x64 files
└── win-ia32-unpacked/ # Unpacked x86 files
# Quick development build (skip packaging)
npm run build:win -- --dir
# Build and test specific target
npm run build:win -- --win portable --x64
& "dist\S3 Migration Scheduler-1.0.0-portable-x64.exe"
# Clean build (fresh start)
rm -rf node_modules, dist
npm install
npm run build:win# 1. Update version in package.json files
# 2. Create git tag
git tag v1.0.1
git push origin v1.0.1
# 3. Build release packages
npm run build:win
# 4. Test all packages
# 5. Upload to GitHub ReleasesNeed help? Check the main Windows README or open an issue on GitHub!