Documentation for running NW.js games on Linux?

Get help using Construct 3!

Post » Tue Oct 17, 2017 5:48 pm

I was wondering if someone had a link to some current documentation on how to run NW.js games on Linux OS?

I cant seem to get any NW.js games to run on Linux. I have two machines I run Linux on. One uses Ubuntu Studio, and the other uses Ubuntu desktop. Iv tried running NW.js games with no success on either of my machines. I even tried exporting a game directly from C3 onto these machines thinking that there might have been a problem with the file transfer from a Windows OS build to a Linux OS machine. Iv also tried downloading other peoples games from itch.io, and cant seem to get one of them to run.

Any help would be greatly appreciated.
B
65
S
16
G
8
Posts: 489
Reputation: 10,831

Post » Wed Oct 18, 2017 9:47 am

See exporting desktop apps with NW.js, particularly the part about file permissions.
Scirra Founder
B
402
S
238
G
89
Posts: 24,613
Reputation: 195,993

Post » Fri Oct 20, 2017 1:21 am

Thank you Ashley for the link and response, but I guess what I don't understand might be even more basic.

When C3 exports a linux game it comes zipped in a file with your game name. Like this: "MyGameName.zip"

Then when you extract the file you have a file named for the operating system you are using. Like this: "linux32"

Inside of that file there is an executable named: "nacl_helper_bootstrap"

I have tried to run the game with these methods so far after extracting the "linux32" file:

1. Double clicking on the "nacl_helper_bootstrap" executable. When I do this nothing happens.

2. Right clicking on the "nacl_helper_bootstrap" executable, and selecting "Execute". When I do this nothing happens.

3. Opening the file named "linux32" with the Terminal. Then typing "chmod a+x linux32" into the Terminal. When I do this I get a message saying "chmod: cannot access 'linux32': No such file or directory".

4. Opening the executable named "nacl_helper_bootstrap" with the Root Terminal. Then typing "chmod a+x nacl_helper_bootstrap" and hitting enter. Then typing "./nacl_helper_bootstrap.run" and hitting enter. When I do this I get I get a message saying "bash: ./nacl_helper_bootstrap.run: No such file or directory".

I guess I really don't understand the proper steps to run an NW.js game on linux.
B
65
S
16
G
8
Posts: 489
Reputation: 10,831

Post » Fri Oct 20, 2017 10:34 am

Oh, right, in C3 as long as you extract the zip on the target system it will set the correct permissions, so you shouldn't need to worry about that.

nacl_helper_bootstrap is the wrong file. The file will be named either nw or the name of your project (I can't remember which right now)
Scirra Founder
B
402
S
238
G
89
Posts: 24,613
Reputation: 195,993

Post » Fri Oct 20, 2017 11:18 am

Oh, thank you very much Ashley! Yes, the file name is "nw". It runs perfectly!

For anyone wondering how to run an NW.js game exported from C3 on Linux here are the steps:

1. Extract your .zip game file.

2. Open your newly extracted file folder.

3. Double click on the file named "nw", and from your File Manager select Open With "Terminal Eliminator". Alternatively you could just right click on the "nw" file, and select Open With "Terminal Eliminator". Either way your game should start right up.

Edit: Once your game has been run once from your "Terminal Eliminator" it will automatically open every time just by double clicking on the "nw" file.

I think it would be a good idea for those of you distributing your games for Linux to include a read me, or at least provide instructions on your download page.

Thank's again Ashley!
B
65
S
16
G
8
Posts: 489
Reputation: 10,831

Post » Sat Nov 04, 2017 5:03 pm

Wink wrote:3. Double click on the file named "nw", and from your File Manager select Open With "Terminal Eliminator". Alternatively you could just right click on the "nw" file, and select Open With "Terminal Eliminator". Either way your game should start right up.


Are you actually referring to Terminal Emulator? Either way, didn't work for me. Still trying to figure this one out...
B
98
S
35
G
11
Posts: 289
Reputation: 13,082

Post » Mon Nov 06, 2017 12:20 am

Cryptwalker wrote:Are you actually referring to Terminal Emulator? Either way, didn't work for me. Still trying to figure this one out...


Yes, Cryptwalker I am referring to the "Terminal Emulator".

You might have to "chmod a+x yourgame" if you didn't extract the zip file on your targeted system. https://www.scirra.com/tutorials/1276/e ... ode-webkit

Did you compile your game in C3 or C2?

The reason I ask is because with C3 as long as you extract the zip file on your targeted system it will set the correct file permissions. With C2 you might have to "chmod a+x yourgame" even if you extract the zip file on your targeted system.
B
65
S
16
G
8
Posts: 489
Reputation: 10,831

Post » Mon Nov 06, 2017 1:46 am

Wink wrote:Did you compile your game in C3 or C2?

@Ashley
I'm using C3. Originally, i had to build an export to 32-bit Linux from a Windows system as it kept on crashing the browser (could be a bug...) and then download it to the Linux system from another location. Next, i litterally was able to build it directly on the Linux system when I selected both 32-bit and 64-bit, and download it directly. But still...same issue. It just opens the terminal window quickly and then closes it out.

I also already tried the chmod a+x yourgame and still not working. I'm getting a "command not found" error when trying to run nw....which i'm assuming (not a linux buff here..) that all i need to actually do is just type nw and enter to run it. Weird thing is that nw is listed as an executable when doing a directory listing. Just weird.

I should mention that I'm on a Tinker Board running a version of Debian. Everything works great on it...especially on this tiny thing. Matter of fact, i'm browsing the web and working on this C3 project while typing this out on it right now. Just can't get the nw.js to run on it...
B
98
S
35
G
11
Posts: 289
Reputation: 13,082

Post » Mon Nov 06, 2017 10:55 am

I think there are now more files that need to be marked executable:

nw (or whatever the main file with the name of your project is)
nacl_helper
nacl_helper_bootstrap
anything ending in .so

If those are all marked executable the NW.js app should start up.

It's a bit tricky given C2 exports on Windows which doesn't handle UNIX file permissions :-\ We should probably make a bash script to do that...
Scirra Founder
B
402
S
238
G
89
Posts: 24,613
Reputation: 195,993

Post » Mon Nov 06, 2017 9:43 pm

Ashley wrote:nw (or whatever the main file with the name of your project is)
nacl_helper
nacl_helper_bootstrap
anything ending in .so


So i chmod a+x nw, nacl_helper, nacl_helper_bootsrap, as well as all the .so files in the lib folder...and still not running. In the command line, I even bash nw and got "cannot execute binary file" error. I tried to ./nw and got "Exec format error". It almost as if it just doesn't want to recognize nw as an executable...
B
98
S
35
G
11
Posts: 289
Reputation: 13,082


Return to How do I...?

Who is online

Users browsing this forum: No registered users and 1 guest