question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MSI build fails with light.exe : error LGHT0216 : An unexpected Win32 exception with error code 0x2 occurred: File not found.

See original GitHub issue
  • Version: 21.2.0
  • Target: Windows

The MSI build is failing. My OS details: Wine: 4.17 OS: openSUSE Tumbleweed

rush@rushpod: /c [master] 2m 30s » electron-builder -w
  • electron-builder  version=21.2.0 os=5.3.5-1-default
  • loaded configuration  file=/c/electron-builder.json
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=win32 arch=x64 electron=6.0.12 appOutDir=dist/win-unpacked
  • building        target=MSI arch=x64 file=dist/App-v4.20.0.msi
  • building        target=nsis file=dist/App-v4.20.0.exe archs=x64 oneClick=true perMachine=true
  • building        target=portable file=dist/Portable App v4.20.0.exe archs=x64
  ⨯ cannot execute  cause=exit status 216
                    out=WiX Toolset Linker version 
    Copyright (c) .NET Foundation and contributors. All rights reserved.
    
    Updating file information.
    Creating cabinet files.
    There will be '8' threads used to produce CAB files.
    Creating cabinet 'C:\users\rush\Temp\wix191022T1311510164\#cab1.cab'.
    Generating database.
    
                    errorOut=Invalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 key0009:fixme:mscoree:ConfigFileHandler_startElement Unknown element L"loadFromRemoteSources" in state 4
    0009:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 0x32ec68, 0x155078, 0x32ec6c, 0x32ec60
    0009:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 0x32ec68, 0x155290, 0x32ec6c, 0x32ec60
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    002d:fixme:cabinet:FCIAddFile compression 1503 not supported, defaulting to none
    0009:fixme:ntdll:NtLockFile I/O completion on lock not implemented yet
    light.exe : error LGHT0216 : An unexpected Win32 exception with error code 0x2 occurred: File not found.
    
    
                    command=wine 'Z:\home\rush\.cache\electron-builder\wix\wix-4.0.0.5512.2\light.exe' -out 'Z:\c\dist\App-v4.20.0.msi' -v -spdb -sw1076 '-dappDir=Z:\c\dist\win-unpacked' -pedantic -wx -sval project.wixobj
                    workingDir=

After running with WINEDEBUG I am getting the following log:

rush@rushpod:/c/dist/__msi-x64> WINEDEBUG=warn+all wine 'Z:\home\rush\.cache\electron-builder\wix\wix-4.0.0.5512.2\light.exe' -out 'Z:\c\dist\App-v4.20.0.msi' -v -spdb -sw1076 '-dappDir=Z:\c\dist\win-unpacked' -pedantic -wx -sval project.wixobj

0009:warn:ntdll:NtQueryFullAttributesFile L"\??\C:\users\rush\Temp\wix191022T1330010109\InstallExecuteSequence.idt" not found (c0000034) 0009:warn:ntdll:NtQueryAttributesFile L"\??\C:\users\rush\Temp\wix191022T1330010109\InstallExecuteSequence.idt" not found (c0000034) 0009:warn:ntdll:NtQueryFullAttributesFile L"\??\C:\users\rush\Temp\wix191022T1330010109\MsiFileHash.idt" not found (c0000034) 0009:warn:ntdll:NtQueryAttributesFile L"\??\C:\users\rush\Temp\wix191022T1330010109\MsiFileHash.idt" not found (c0000034) 0009:warn:ntdll:FILE_CreateFile L"\??\C:\users\rush\Temp\wix191022T1330010109\#cab1.cab" not found (c0000034) 0009:warn:file:CreateFileW Unable to create file L"C:\users\rush\Temp\wix191022T1330010109\#cab1.cab" (status c0000034) 0009:warn:ntdll:FILE_CreateFile L"\??\C:\windows\mono\mono-2.0\lib\mono\gac\System\4.0.0.0__b77a5c561934e089\Kernel32.dll" not found (c0000034) 0009:warn:ntdll:FILE_CreateFile L"\??\Z:\usr\bin\…\lib\wine\kernel32.dll" not found (c0000034) light.exe : error LGHT0216 : An unexpected Win32 exception with error code 0x2 occurred: File not found.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
luke-develcommented, Dec 2, 2020

I have changed my root package.json from:

 "win": {
      "target": [
        "nsis",
        "msi"
      ]
 },

To:

"win": {
      "target": [
        "nsis"
      ]
 },

Which avoids this error for now - just remove the “msi” target option.

0reactions
Kasalehliacommented, Jul 18, 2022

In case anyone stumbles upon this error: for me this error was triggered by disabling asar. When building with asar enabled, the MSI builds without problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

An unexpected Win32 exception with error code 0x65B ...
light.exe(0,0): error LGHT0216: An unexpected Win32 exception with error code 0x65B occurred: Function failed during execution. Done building project ...
Read more >
Windows Installer Error Messages (for Developers)
Message codes, message text, and remarks for Windows Installer error messages. Errors include ship errors, internal errors, and errors ...
Read more >
Re: [WiX-users] version 3 - error LGHT0216 | WiX toolset
light.exe : error LGHT0216 : An unexpected Win32 exception occurred: The > system cannot open the device or file specified > > c:\wix>...
Read more >
Exceptions - OSDev Wiki
Exceptions, as described in this article, are a type of interrupt generated by the CPU when an 'error' occurs. Some exceptions are not...
Read more >
What do the various Windows Installer (MSI) error codes mean?
The errors returned by the Windows Installer service are unique to MSI setups, each one providing some level of help to specify a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found