π > Development > Building
Building Megacubo IPTV Player
This guide provides instructions for building IPTV player installers for Windows IPTV app, Linux IPTV software, and macOS IPTV player using electron-builder.
Prerequisitesβ
IPTV Player Build Requirementsβ
Ensure you have Node.js (version 18 or higher) and npm installed on your system for building the IPTV streaming application.
System Dependenciesβ
Windowsβ
For Windows builds, you need:
# No additional system dependencies required for basic builds
# For MSI builds, ensure you have Windows SDK installed
macOSβ
For macOS builds, you need Xcode Command Line Tools:
xcode-select --install
Linuxβ
To build different Linux installer formats, you need to install the following dependencies:
Ubuntu/Debianβ
sudo apt update
sudo apt install -y \
flatpak \
flatpak-builder \
snapd \
snapcraft \
fuse \
libnss3-dev \
libatk-bridge2.0-dev \
libdrm2 \
libxkbcommon-dev \
libxcomposite-dev \
libxdamage-dev \
libxrandr-dev \
libgbm-dev \
libxss1 \
libasound2-dev \
libgtk-3-dev \
libgconf-2-4 \
rpm \
dpkg-dev
Fedora/RHEL/CentOSβ
sudo dnf install -y \
flatpak \
flatpak-builder \
snapd \
snapcraft \
fuse \
libnss3-devel \
libatk-bridge2.0-devel \
libdrm-devel \
libxkbcommon-devel \
libXcomposite-devel \
libXdamage-devel \
libXrandr-devel \
libgbm-devel \
libXScrnSaver-devel \
alsa-lib-devel \
gtk3-devel \
GConf2-devel \
rpm-build
Arch Linuxβ
sudo pacman -S \
flatpak \
flatpak-builder \
snapd \
snapcraft \
fuse2 \
nss \
atk \
libdrm \
libxkbcommon \
libxcomposite \
libxdamage \
libxrandr \
libgbm \
libxss \
alsa-lib \
gtk3 \
gconf \
rpm-tools
Flatpak Setup (Linux only)β
After installing flatpak, add the Flathub repository:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub org.freedesktop.Platform//23.08
flatpak install flathub org.freedesktop.Sdk//23.08
flatpak install flathub org.electronjs.Electron2.BaseApp
Snap Setup (Linux only)β
Make sure snapd is running:
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
Installing Node.js Dependenciesβ
npm install
Note: If you encounter disk space issues during installation, consider clearing the npm cache:
npm cache clean --force
Preparing the Projectβ
Before building, you need to prepare the project (compile and bundle the code):
npm run prepare
This command:
- Compiles TypeScript/JavaScript files
- Bundles the application code
- Generates necessary assets in
www/nodejs/dist/ - Prepares everything needed for electron-builder
Important: Always run
npm run preparebefore any build command. The optimized builds require this step to function properly.
Build Commandsβ
Optimized Builds (Recommended)β
All Platformsβ
npm run build:electron:all
Specific Platformsβ
npm run build:electron:win # Windows MSI installer (~100MB)
npm run build:electron:linux # Linux AppImage (~100MB)
npm run build:electron:mac # macOS DMG (~100MB)
Installer Types:
- MSI: Windows installer with uninstaller in Control Panel
- AppImage: Portable Linux application that runs on most distributions
- DMG: macOS disk image installer
Optimized Builds (Only Available)β
β οΈ WARNING: Only optimized builds are available to prevent accidental generation of bloated ~4GB installers.
# All platforms
npm run build:electron:all
# Specific platforms
npm run build:electron:linux # Linux AppImage
npm run build:electron:win # Windows MSI
npm run build:electron:mac # macOS DMG
Structure of Generated Filesβ
After building, the installers will be created in the dist/ directory:
Windowsβ
dist/
βββ megacubo-17.6.2.msi # MSI installer (recommended)
βββ megacubo Setup 17.6.2.exe # NSIS installer
Linuxβ
dist/
βββ Megacubo-17.6.2.AppImage # AppImage (recommended)
βββ megacubo_17.6.2_amd64.snap # Snap
βββ tv.megacubo.app.flatpak # Flatpak
βββ megacubo_17.6.2_amd64.deb # Debian/Ubuntu
βββ megacubo-17.6.2.x86_64.rpm # Fedora/RHEL
macOSβ
dist/
βββ Megacubo-17.6.2.dmg # DMG installer (recommended)
βββ Megacubo-17.6.2-mac.zip # ZIP archive
Troubleshootingβ
Cross-Platform Issuesβ
Problem: "electron-builder: command not found"β
Solution: Run npm install to install dependencies.
Problem: "Cannot find module" errorsβ
Solution: Run npm run prepare before building.
Problem: Build hangs or runs out of memoryβ
Solution: Close other applications and ensure at least 4GB RAM available.
Problem: "no such file or directory" errorsβ
Solution: Ensure www/nodejs/dist/ exists. Run npm run prepare first.
Windows-Specific Issuesβ
Problem: MSI build fails with "Icon not found"β
Solution: Ensure build/icon.ico exists. Copy your icon to this location.
Problem: "Megacubo still open" during installationβ
Solution: Close all Megacubo processes and delete previous installation.
Problem: Installer size too large (>1GB)β
Solution: Use npm run build:electron:win.
Linux-Specific Issuesβ
Problem: "flatpak-builder: command not found"β
Solution: Install flatpak-builder as described above.
Problem: "snapcraft: command not found"β
Solution: Install snapcraft as described above.
Problem: Permission error with Snapβ
Solution: Run as root or configure snapcraft to use classic mode.
Problem: FFmpeg compilation failure on Flatpakβ
Solution: Ensure all development dependencies are installed.
Problem: AppImage does not runβ
Solution: Make sure FUSE is installed and properly configured.
macOS-Specific Issuesβ
Problem: "Code signing required"β
Solution: For development, use --publish=never. For distribution, configure code signing.
Problem: DMG creation failsβ
Solution: Ensure Xcode Command Line Tools are installed.
Problem: "Cannot build for macOS on Windows"β
Solution: macOS builds require macOS environment. Use cross-compilation if available.
Distributionβ
Windowsβ
- MSI: Recommended for enterprise deployment and Windows Store
- NSIS: Traditional installer with setup wizard
Linuxβ
- AppImage: Portable format, runs on any Linux distribution
- Flatpak: Publish on Flathub for wide distribution
- Snap: Publish on Snap Store (Ubuntu Software Center)
- DEB: Ubuntu/Debian package repositories
- RPM: Fedora/RHEL package repositories
macOSβ
- DMG: Native macOS installer format
- ZIP: Simple archive for manual installation
Automated Publishingβ
For automated publishing to GitHub Releases:
npm run build:electron:publish # Builds and publishes all platforms
This will create GitHub releases with installers for all supported platforms.
Developmentβ
Local Development Buildsβ
For testing without publishing:
# Optimized builds
npm run build:electron:win -- --publish=never
npm run build:electron:linux -- --publish=never
npm run build:electron:mac -- --publish=never
Production Buildsβ
For production builds with automatic publishing to GitHub:
npm run build:electron:publish # All platforms
See Alsoβ
- Development Setup - How to set up your development environment
- Contributing - How to contribute to the project
- Installation - Installing Megacubo (for users)