GithubHelp home page GithubHelp logo

Comments (10)

ukoloff avatar ukoloff commented on June 19, 2024 2

Well, v3.2.1 is published with @M0rious's patch.

Feel free to test and report.

from electron-win-ca.

ukoloff avatar ukoloff commented on June 19, 2024

Unfortunately, I have no experience with asar, but what I understand:

I believe this is due to permission issues since the file exists

Nope, this is NOT permission issue. File win-ca\lib\root.exe cannot be run. This is Windows executable, it cannot run from archive (as far as I know), it should reside in regular folder.

Try patching fallback.js file before packing. Replace spawn[Sync] calls with execFile[Sync]. ASAR documentation states these API calls handle process spawning correctly. Should be investigated.

Stack: Error: Cannot find module 'split'

Folder app.asar.unpacked according to documentation contains only some files from ASAR archive, it obviously misses node_modules. If you plan to use unpacked archive - unpack it yourself with all contents. But then there is no point in using ASAR...

So far, it seems to me, current version of win-ca will NOT play good with ASAR. We should either patch it somehow or switch to another bundling method (or may be reject to pack win-ca at all).

from electron-win-ca.

ukoloff avatar ukoloff commented on June 19, 2024

I tested execFile. it works inside win-ca.

Now you should test it under asar.

This is fallback.js.zip to replace win-ca/lib/fallback.js. Pack to ASAR and test it working.

I think, you'd better mark win-ca/lib/roots.exe as unpack in ASAR, but it's up to you.

from electron-win-ca.

ukoloff avatar ukoloff commented on June 19, 2024

win-ca v3.1.0 is out. Should work with ASAR.

from electron-win-ca.

vogoltsov avatar vogoltsov commented on June 19, 2024

Still doesn't work in asar for me. Got the same problem:

Error: ENOENT, node_modules\win-ca\lib\roots not found in C:\Program Files\<program>\resources\app.asar
    at createError (electron/js2c/asar.js:126:17)
    at Object.func [as execFileSync] (electron/js2c/asar.js:161:27)
    at Object.run (C:\Program Files\<program>\resources\app.asar\node_modules\win-ca\lib\fallback.js:36:26)
    at Function.api (C:\Program Files\<program>\resources\app.asar\node_modules\win-ca\lib\index.js:56:10)
    at C:\Program Files\<program>\resources\app.asar\main\main.js:1:64478
    at new Promise (<anonymous>)
    at e.<anonymous> (C:\Program Files\<program>\resources\app.asar\main\main.js:1:64450)
    at step (C:\Program Files\<program>\resources\app.asar\node_modules\tslib\tslib.js:136:27)
    at Object.next (C:\Program Files\<program>\resources\app.asar\node_modules\tslib\tslib.js:117:57)
    at C:\Program Files\<program>\resources\app.asar\node_modules\tslib\tslib.js:110:75

Inspecting the asar shows the roots.exe file is there. I guess (couldn't confirm yet) one should use roots.exe instead of roots when executing from ASAR (see path.join(__dirname, 'roots') in fallback.js) - ASAR doesn't perform lookup of files inside with different extensions (unlike windows shell).

Another problem is you don't expose this as a configuration property for the application - see https://www.npmjs.com/package/regedit: it exposes path to executable VBS scripts through regedit.setExternalVBSLocation(...). It is a common practice to not pack these executables in asar and put them somewhere in the application directory.

from electron-win-ca.

ukoloff avatar ukoloff commented on June 19, 2024

Still doesn't work in asar for me. Got the same problem:

Yeah, I cannot understand how this ASAR thing works at all.

Inspecting the asar shows the roots.exe file is there. I guess (couldn't confirm yet) one should use roots.exe instead of roots

This can do the trick, but I cannot test it right now. Can you patch fallback.js manually and add that .exe extension (line 6)?

Another problem is you don't expose this as a configuration property for the application - see https://www.npmjs.com/package/regedit: it exposes path to executable VBS scripts through regedit.setExternalVBSLocation(...).

I don't believe one should mess with this. It is hardly the case.

It is a common practice to not pack these executables in asar and put them somewhere in the application directory.

As I mentioned earlier, the problem is that I don't understand how ASAR works. I believe it should work seamlessly but it doesn't.

We can make some workarounds for ASAR of course (eg. to copy roots.exe to some temporary folder). But when to apply that scenario? If we are not under ASAR we shouldn't do all these stupid things.

I believe ASAR should do the job. It is responsible. For me everything should just work with ASAR as if no ASAR involved.

By the way, I tried to find source code of ASAR's execFile[Sync] and failed. Do you know where it is? One should rather make Pull Request to that repo, I suppose ;-)

from electron-win-ca.

ukoloff avatar ukoloff commented on June 19, 2024

@vogoltsov I just published win-ca v3,1,1 with the only difference: roots.exe is used (instead of just roots).

Please try it with ASAR.

from electron-win-ca.

Yiddishe-Kop avatar Yiddishe-Kop commented on June 19, 2024

I'm using v3.2.0, and get the same error:

Uncaught Error: ENOENT, node_modules\win-ca\lib\roots not found in C:\Users\yehudaneufeld\AppData\Local\Programs\jewishbooks-wiki\resources\app.asar
    at createError (electron/js2c/asar.js:111)
    at Object.func (electron/js2c/asar.js:146)
    at Object.module.<computed> [as execFile] (electron/js2c/asar.js:167)
    at Object.run (C:\Users\yehudaneufe…\lib\fallback.js:86)
    at api (C:\Users\yehudaneufe…-ca\lib\index.js:56)
    at Object.<anonymous> (C:\Users\yehudaneufe…-ca\lib\index.js:11)
    at Object.<anonymous> (C:\Users\yehudaneufe…ca\lib\index.js:128)
    at Module._compile (internal/modules/cjs/loader.js:967)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1004)
    at Module.load (internal/modules/cjs/loader.js:815)

from electron-win-ca.

M0rious avatar M0rious commented on June 19, 2024

For me it works with
bin = path.join(__dirname, 'roots.exe');
in lib/fallback.js

from electron-win-ca.

Yiddishe-Kop avatar Yiddishe-Kop commented on June 19, 2024

Works now for me!

Thanks!!!

from electron-win-ca.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.