Windows下运行Electron脚本触发‘Check failed: result’错误求助
Hey there, let's work through this error you're hitting when trying to run your service installer via Electron. First, let's recap the details to make sure we're on the same page:
You executed this command:
C:\test\resources\dist\bin\electron\electron.exe C:\test\resources\app.asar\assets\serviceinstaller install "Microsoft Print to PDF" "test_hahu@test.com"
And encountered this fatal error:
Error: Command failed: C:\test\resources\dist\bin\electron\electron.exe C:\test\resources\app.asar\assets\serviceinstaller install "Microsoft Print to PDF" "test_hahu@eprinter.com" [3204:0412/194310.130:FATAL:icu_util.cc(292)] Check failed: result. Backtrace: GetH...
This error points to a failure in Electron's ICU (International Components for Unicode) initialization—let's go through actionable fixes to resolve this:
1. Confirm Electron's ICU Files Are Intact
The icu_util.cc error means Electron can't load its required Unicode support files. Here's what to check:
- Head to your Electron binary directory:
C:\test\resources\dist\bin\electron\ - Look for a file named
icudtl.dat—this is the critical ICU data file. If it's missing, corrupted, or incomplete, this will trigger the fatal error. - Replace your Electron binaries with a fresh, uncorrupted copy matching your app's target version. Incomplete builds or corrupted downloads often cause this issue.
2. Run the Command with Administrator Privileges
Since you're installing a system service, your command likely needs elevated permissions to execute properly:
- Right-click on Command Prompt or PowerShell and select "Run as administrator"
- Re-run your original command (or the quoted version below) with admin rights. Missing privileges can lead to unexpected low-level initialization failures like this.
3. Properly Quote All Paths in the Command
Even if your paths seem fine, wrapping executable and script paths in quotes can avoid parsing issues, especially if there are hidden spaces or special characters:
"C:\test\resources\dist\bin\electron\electron.exe" "C:\test\resources\app.asar\assets\serviceinstaller" install "Microsoft Print to PDF" "test_hahu@test.com"
4. Isolate the Issue with a Minimal Electron Test
To rule out problems with your packaged app.asar or serviceinstaller script:
- Set up a simple, fresh Electron project (use the basic quick-start template)
- Run a minimal command with this clean Electron instance. If it runs without errors, the issue is likely in your packaged app or the serviceinstaller code itself.
- Check if the serviceinstaller script has dependencies that conflict with Electron's internal ICU setup.
5. Upgrade Electron to a Stable, Bug-Free Version
Older Electron versions sometimes have known bugs related to ICU initialization. Try:
- Upgrading to the latest stable release of Electron
- Rebuilding your app's binaries and re-packaging the
app.asarfile. Many ICU-related crashes have been fixed in newer releases.
内容的提问来源于stack exchange,提问作者EldarGranulo

