Working on GNU/Linux, I followed the steps explained in the wiki in order to package my app.
I eventually understood that the executable produced had to be in the same directory as the nw.pak file you provide.
I was wondering if there was a solution to get over this restriction since it might be easier to use.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
You don't need to have them in the same folder, you can just copy from two different areas...
copy /b C:\nw.exe+D:\app.nw D:\app.exe
Thank you for your attention.
I'm not talking about nw/nw.exe. I'm talking about nw.pak, which has to be in the same directory as app.exe when you run your packaged application.
If nw.pak is missing next to my executable, I get the following error:
ctor.super_ = superCtor;
TypeError: Cannot set property 'super_' of undefined
at Object.exports.inherits (util.js:537:15)
at Function.startup.initNw (node.js:503:34)
at startup (node.js:63:13)
PS: here is the script I use to build my app:
cd app &&
zip -r ../app.nw * &&
cd .. &&
cat node-webkit-v0.4.2-linux-x64/nw app.nw > pdf-merge &&
chmod +x pdf-merge &&
+1 if possible
Node-webkit already supports attaching some zipped application to the tail of the main binary.
Could it also support adding the rest of the necessary files (such as nw.pak, icudt.dll, ffmpegsumo.dll, libEGL.dll, libGLESv2.dll, D3DCompiler_43.dll, d3dx9_43.dll, libffmpeg.so) to the same tail-attached zip file where necessary? (Which seems like the only way to make the resulting executable really a single file.)
It would essentially mean additionally looking at the unpack path when these assets are missing at the application's path. (Maybe not directly at the unpack path, but in a subdirectory with some name /assets/ like the existing /plugins/ and /node_modules/.)
I also agree that making the most necessary files (nw.pak on Linux, nw.pak and icudt.dll on Windows) an integral part of the main binary would be an improvement (to reduce the chance they are missing). The application won't run without them anyway, or so it seems.
@Mithgol, +1 for your idea. I think all files should be merged together in a single executable.
Glad to see I'm not the only one interested.
I just wanted to disambiguate something: I was not talking about the shared libraries (e.g. .dll on Windows) that others are talking about.
I don't think they may/can be bundled within the NW executable since they are shared libraries: they may be shared with others programs or their licence may not let us bundle it into the main executable.
IMO it is our responsibility to make an installer (for instance with something like Inno Setup on Windows or with .deb packages on Debian based distributions etc.) that installs the dependencies (if necessary) and our executable in the right place.
What I was talking about is the nw.pak file, which seems to be part of the Node Webkit system (I just supposed that because of its name). If it is part of Node Webkit and if it is absolutely necessary in any case, why is it not bundled with the rest of the runtime?
That's a good objection. I've never thought about it, but packing D3DCompiler_43.dll and d3dx9_43.dll and distributing them with your application could actually be illegal in some jurisdictions because of the license that governs DirectX. (The rest of the above mentioned libraries are probably fine, because they're free software unless I'm missing something about them.)
Free software does not mean that you can do anything you want. For instance, you cannot bundle a (L)GPL library into a non free executable.
Anyway, those libraries are not part of NW so they must not be within it. But what about nw.pak? I don't even know what it is, but I guess it is related to the manifest parsing. If so, since the manifest is required, this file should be part of the bundle (imo).
I've implemented a fix to store nw.pak/dll's/etc all into the zip file. However this required a small bit of refactoring to the self extractor and may not be the best approach. Also, probably doesn't work on linux (I don't have a build for it).
Chromium upstream doesn't support put everything in a single executable file.