Skip to content

Usage with asar

ssight edited this page Jul 13, 2020 · 1 revision

If you plan on using native-prompt with an electron app packed with asar, you'll need to make some changes to the way you pack your app, as asar currently doesn't support spawn, which means native-prompt will not be able to work. However, there is a way to mitigate this.

As mentioned in the docs, you can use the --unpack option to specify files that are not to be included in the archive. If, for example, we had a directory structure like this:

app/
+----node_modules/
|   |   ...
|   +---native-prompt
|   |   ...
+---package.json
+---index.js
+---index.html

We could run asar pack app app.asar --unpack app/node_modules/native-prompt/**/* instead of just asar pack app app.asar in order to leave native-prompt out of the archive. This will generate a new app.asar.unpacked folder with native-prompt in it, that will need to be distributed alongside the newly created app.asar file.

Clone this wiki locally