“Don’t be so enchanted, will you?”

“Xiao Ming said: I can’t do it, can’t do it!”

I have encountered a problem, for which I have been confused for several days and cannot solve it. Regarding the problem that Electron can use binary files in ASAR package, it is very painful to solve this problem, but I still have to solve it and find a solution.

The first solution I could think of, the official documentation was almost broken. I googled it and said that you could set ASar :false in package.json file to disable ASAR. The development version works, but if the signature that the installation version needs to verify fails after the build, the problem is still unresolved.

The second step is to submit issues at the official warehouse: https://github.com/electron/electron/issues/11566, finding someone to help you find the experts for advice, Submit questions or to compare well-known communities in the https://cnodejs.org/topic/5a557d0eafa0a121784a8ad0, see if there are any others met the same problem, and can be solved. However, to a large extent, still need to rely on their own to solve the problem, waiting for many days or no one to answer.

Thank the Wolf uncle to help me look for someone to see this problem in time, it seems that this way does not work, how to do?

So, I’m going to try a hardcoded way to replace different paths for different operating systems, and test it for now. Mac 10.13.1 and Mac 10.13.2 are available.

Today I finally found some valuable information in the Electron warehouse:

There are Node APIs that can execute binaries like child_process.exec, child_process.spawn and child_process.execFile, but only execFile is supported to execute binaries inside asar archive.

This is because exec and spawn accept command instead of file as input, and commands are executed under shell.

  • https://github.com/electron/electron/blob/master/docs/tutorial/application-packaging.md#executing-binaries-inside-asar-a rchive

This is not entirely correct. .spawn() executes the binary directly by default, just as  .execFile()does. .execFile() actually uses  .spawn() underneath. .spawn()  only runs the input in a shell if the shell  option is set.

Not supporting .spawn() means a lot of apps are not able to use ASAR as they need the more flexible .spawn() method. For example, I need the .spawn() method so I can stream the output of ffmpeg while it’s running. .execFile() only buffers and reports at the end.

Would also make sense to support .spawnSync() for completeness.

Details can be found at:

  • https://github.com/electron/electron/issues/9459 

  • https://github.com/electron/electron/issues/9459

Spawn is not supported if you want to use binary files under ASAR. Same thing I did, hard code it.

exports.fixPathForAsarUnpack = path => exports.isUsingAsar ? path.replace(‘app.asar’, ‘app.asar.unpacked’) : path;

Here we go again. Nw Market was this recommended? Yes, friends in the community recommend using Nw. js to solve this problem, the problem is, I wrote this thing based on electron. Want to cry no tears?

If you had a problem, how would you solve it? Did you do it the same way I did, or did you wait for someone else to solve it for you? In fact, this is a “posture” of the different, rather than waiting, it is better to take the initiative, of course, you can also expect others to help you solve, at least this can save a lot of time, at the same time, they should have a metaphysical attitude, afraid of cats? You all chose to be a programmer, so horrible occupation all went up, still afraid of this one or two difficult problems?

From the perspective of my solution to the importance of Google for the majority of technical compatriots, the community in our hearts must have important guidance, such as you can timely submit issues, if you can directly to the author, then you can quickly get the solution, of course, submitting issues should be the last step. If the front, in Google search can be found, we still do not bother the author, we should take the initiative, or think about why this design is like this, what problems to solve, what problems will occur. You might even be able to submit a PR or two to a high-profile project.

Finally do his own small tools, can apply for and are interested in https://github.com/icepy/blockchain-navigate-code/issues/1, of course, see the mood to go through. In addition to learning block chain technology friend, https://icepy.me/blockchain-navigate/#/ can be added to the bookmarks, worth it.

If these shares are useful to you, support tipping:

Cardano tip address:

DdzFFzCqrhssiX2gAn17QNegNvSEixGi5RtgmEqeNrghMnU3F6GbmD1SWA3ZEKkTCuYnMnXTTpwWZrJpfxxiaLwg1Fm4p5z5WeyQWmbB

Any token of ERC 20 standard, tipping address:

 0x4A40Eb870DcF533D4dC097c3d87aaFE9f64490A1