5.2 KiB
Desktop Build Fix Summary
Problem
The Windows desktop build was failing in GitHub Actions with the error:
Error Input watch path is neither a file nor a directory.
This error occurred after the UI preparation step completed successfully, indicating that Tauri couldn't find the expected UI distribution directory.
Root Causes Identified
-
Incorrect distDir path:
tauri.conf.jsonspecified"distDir": "../ui-dist"which pointed to the wrong location- Expected:
/home/engine/project/ui-dist - Actual:
/home/engine/project/windows-app/ui-dist
- Expected:
-
Missing build.rs: Tauri requires a
build.rsfile in the src-tauri directory to generate necessary build artifacts -
Incompatible tauri-plugin-store dependency: The plugin version
0.6is incompatible with Tauri 1.5 (v0.6 doesn't exist, only v2.x which is for Tauri v2) -
Missing tauri-build dependency: The Cargo.toml was missing the required
tauri-buildin[build-dependencies]
Changes Made
1. Fixed tauri.conf.json
File: windows-app/tauri.conf.json
- Changed
"distDir": "../ui-dist"to"distDir": "./ui-dist" - This ensures Tauri looks for the UI in the correct location relative to the tauri.conf.json file
2. Created build.rs
File: windows-app/src-tauri/build.rs (NEW)
fn main() {
tauri_build::build()
}
- Required by Tauri to generate build-time configuration and resources
3. Updated Cargo.toml
File: windows-app/src-tauri/Cargo.toml
Removed:
tauri-plugin-store = "0.6"from dependenciesfeatures = ["api-all"]from tauri dependency (to avoid potential issues)
Added:
tauri-build = { version = "1.5", features = [] }in[build-dependencies]- Updated features to properly reference tauri:
[features] default = ["custom-protocol"] custom-protocol = ["tauri/custom-protocol"]
Final dependencies:
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0"
reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tauri = { version = "1.5", features = [] }
[build-dependencies]
tauri-build = { version = "1.5", features = [] }
4. Replaced tauri-plugin-store with Custom Implementation
File: windows-app/src-tauri/src/main.rs
Removed:
use tauri_plugin_store::StoreBuilder;.plugin(tauri_plugin_store::Builder::default().build())from main()
Added:
- Custom
SecureStorestruct that implements file-based JSON storage:#[derive(Serialize, Deserialize, Clone, Debug, Default)] struct SecureStore { data: HashMap<String, String>, } - Implements async
load(),save(),get(), andinsert()methods - Changed store file from
secure.storetosecure.json - Maintains same API surface for the rest of the application
Benefits:
- No external plugin dependencies
- Simpler, more maintainable code
- Same functionality as before
- Works with Tauri 1.5 without version conflicts
5. Generated Cargo.lock
File: windows-app/src-tauri/Cargo.lock (NEW)
- Generated with
cargo generate-lockfile - Ensures consistent dependency versions across builds
- GitHub Actions cache now properly uses this for cache key
GitHub Actions Workflow
File: .github/workflows/windows-app.yml
The workflow was already well-structured and didn't require changes. It now properly:
- Checks out the code
- Sets up Node.js and Rust
- Caches cargo dependencies using Cargo.lock
- Installs npm dependencies
- Verifies UI source exists
- Prepares UI with
npm run prepare-ui - Verifies UI dist was created
- Builds the desktop app with
npm run build - Uploads build artifacts
Testing
The changes were designed to be minimal and focused on fixing the specific build issues:
- The UI preparation script (
sync-ui.js) remains unchanged - The application logic in main.rs remains functionally identical
- Only the storage backend was changed from plugin to custom implementation
- All Tauri commands remain the same
Expected Results
With these changes, the Windows build in GitHub Actions should:
- ✅ Successfully find the UI distribution directory
- ✅ Compile without dependency conflicts
- ✅ Generate all required build artifacts
- ✅ Produce Windows installer files (NSIS and MSI)
- ✅ Upload artifacts for download
Notes for Future Maintenance
-
Tauri Version: Currently using Tauri 1.5. If upgrading to Tauri 2.x in the future:
- Update Cargo.toml dependencies
- Re-evaluate tauri-plugin-store (v2.x is compatible with Tauri 2.x)
- Review tauri.conf.json schema changes
- Update GitHub Actions workflow if needed
-
Custom SecureStore: The current implementation is simple and adequate. For enhanced security:
- Consider encrypting the JSON file at rest
- Use OS keychain/credential manager integration
- Implement proper file permissions checks
-
Dependencies: Keep an eye on:
- Tauri security updates
- Rust toolchain updates
- WebView2 runtime updates on Windows
Build Command
To build locally (on Windows):
cd windows-app
npm install
npm run prepare-ui
npm run build
To run in development mode:
cd windows-app
npm install
npm run prepare-ui
npm run dev