Electron-builder: __shim.js not found upon launch

Created on 3 Oct 2017  路  5Comments  路  Source: electron-userland/electron-builder


  • Version: 19.33.0

  • Target: win32.nsis

After the setup when I try to launch the exe, I get this trace:

Error: Cannot find module 'C:\Users\kon\AppData\Local\Programs\vt\resources\app.asar\__shim.js'
    at Module._resolveFilename (module.js:470:15)
    at Function.Module._resolveFilename (O:\kon\AppData\Local\Programs\vt\resources\electron.asar\common\reset-search-paths.js:35:12)
    at Function.Module._load (module.js:418:25)
    at Object.<anonymous> (O:\kon\AppData\Local\Programs\vt\resources\electron.asar\browser\init.js:171:8)
    at Object.<anonymous> (O:\kon\AppData\Local\Programs\vt\resources\electron.asar\browser\init.js:173:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

In app.asar:

$ pwd
/c/Users/kon/AppData/Local/Programs/vt/resources

$ asar ef app.asar ___shim.js
O:\kon\AppData\Roaming\npm\node_modules\asar\lib\filesystem.js:144
    if (info.link && followLinks) {
            ^
TypeError: Cannot read property 'link' of undefined

However:

$ asar l app.asar | grep -C5 '__shim'
\.cache\4e1a5069de66f1b2f52927c2388cdfb0756c1285\fad86a314ecc0e771f27f0ad3e5d827512047ab9
\
\
\
\
\__shim.js
\package.json
\node_modules
\node_modules\amd-name-resolver
\node_modules\amd-name-resolver\index.js
\node_modules\amd-name-resolver\package.json

I am wondering if those multiple \ are normal, seems a bit suspicious. I also tried reinstalling asar on this machine with the same result.
Then I tried to re-create the app.asar with __shim.js copied manually and replaced this with the previously generated app.asar. Now the application started and worked.

Any suggestions how to get to the bottom of this? Thanks!

bug

Most helpful comment

This is happening to me as well - it started happening for me with version 19.30.3

Looks possibly related to the logic handling the ASAR packaging. I'm going to try to dig into this further and see if I can determine the exact change.

Perhaps @develar you may have a better idea of what the issue is?

https://github.com/electron-userland/electron-builder/commit/ffe9d54ad0353b91c0d9f54f27cdfbe52a92e27c

All 5 comments

I am having this issue as well over at https://github.com/willyb321/media_mate

I'm getting this on Mac after upgrading to High Sierra and updating to the latest version (19.35.0) to avoid the hang during DMG creation. The build succeeds, but then I get the Uncaught Exception: Error: Cannot find module '/Users/brandon/code/project-name/release/Project.app/Contents/Resources/app.asar/__shim.js error upon launch.

Thanks to you both for sharing the info.
@willyb321 I saw you downgraded electron-builder, was that related to this issue and did it fix it?

@koopa yeah - it was related and downgrading seems to have fixed it.

This is happening to me as well - it started happening for me with version 19.30.3

Looks possibly related to the logic handling the ASAR packaging. I'm going to try to dig into this further and see if I can determine the exact change.

Perhaps @develar you may have a better idea of what the issue is?

https://github.com/electron-userland/electron-builder/commit/ffe9d54ad0353b91c0d9f54f27cdfbe52a92e27c

Was this page helpful?
0 / 5 - 0 ratings