If you encounter issues with bun install or bun run dist:* (such as hanging, timeout, or build failures).
#!/bin/bash
# JarvisX-Cowork One-Click Install Script
cd /path/to/JarvisX-Cowork
# Clean environment
rm -rf node_modules bun.lockb dist/
# Clear potentially corrupted Electron cache
rm -rf ~/Library/Caches/electron/electron-v*-darwin-arm64.zip 2>/dev/null
# Generate package-lock.json
npm install --package-lock-only
# Set mirrors and install
export ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
export ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/
bun install
# Build (macOS ARM64 as example)
bun run dist:mac-arm64
echo "Build complete! App is located at dist/mac-arm64/JarvisX-Cowork.app"Edit the .npmrc file in the project root and uncomment the mirror settings:
registry=https://registry.npmmirror.com
electron_mirror=https://npmmirror.com/mirrors/electron/
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
better_sqlite3_binary_host=https://npmmirror.com/mirrors/better-sqlite3Create a bunfig.toml file in the project root:
[install]
registry = "https://registry.npmmirror.com"electron-builder is not fully compatible with bun. A package-lock.json is needed to help resolve dependencies:
npm install --package-lock-onlyBun doesn't automatically read system proxy settings. You need to set environment variables manually:
# If you're using a proxy (e.g., Clash/Surge), set proxy environment variables
export HTTP_PROXY=http://127.0.0.1:7897
export HTTPS_PROXY=http://127.0.0.1:7897
# If not using a proxy, make sure to clear proxy environment variables
unset HTTP_PROXY HTTPS_PROXY ALL_PROXY# Clean up old files
rm -rf node_modules bun.lockb dist/
# Set mirror environment variable and install
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ bun installIf you see errors like FailedToOpenSocket downloading tarball xxx, use npm to install the failed package separately:
# For example, if caniuse-lite download fails
npm install caniuse-lite --save-dev
# Then re-run bun install
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ bun installIf you see errors like ENOENT: no such file or directory, rename '...MacOS/Electron', the Electron cache may be corrupted and needs to be cleared:
# Clear corrupted Electron cache
rm -rf ~/Library/Caches/electron/electron-v*-darwin-arm64.zip
rm -rf ~/Library/Caches/electron/*darwin-arm64*
# Clear build artifacts
rm -rf dist/
# Then rebuild# macOS Apple Silicon
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ \
ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ \
bun run dist:mac-arm64
# macOS Intel
bun run dist:mac-x64
# Windows
bun run dist:win
# Linux
bun run dist:linux| Issue | Solution |
|---|---|
bun install hangs |
Set proxy environment variables + use mirror |
FailedToOpenSocket error |
Install failed package separately with npm |
ENOENT: rename ...Electron error |
Clear Electron cache and rebuild |
cannot find path for dependency |
Make sure package-lock.json exists |