{"id":185,"date":"2019-01-07T11:30:07","date_gmt":"2019-01-07T11:30:07","guid":{"rendered":"http:\/\/joanalbamaldonado.com\/blog\/?p=185"},"modified":"2019-01-07T11:49:06","modified_gmt":"2019-01-07T11:49:06","slug":"nw-js-port-for-raspberry-pi","status":"publish","type":"post","link":"https:\/\/joanalbamaldonado.com\/blog\/2019\/01\/07\/nw-js-port-for-raspberry-pi\/","title":{"rendered":"NW.js port for Raspberry Pi"},"content":{"rendered":"<p>There is a <a title=\"NW.js web site\" href=\"http:\/\/nwjs.io\/\" target=\"_blank\" rel=\"noopener\">NW.js (formerly node-webkit)<\/a> binary compiled for the <strong>ARMv6<\/strong> used by Raspberry Pi. It also runs on Raspberry Pi 2 and Raspberry Pi 3 since they are backward compatible with ARMv6. Other compatible hardware should also be able to run this binary.<\/p>\n<p>It can be found on GitHub: <a href=\"https:\/\/github.com\/jalbam\/nwjs_rpi\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/jalbam\/nwjs_rpi<\/a><\/p>\n<h2>Instructions<\/h2>\n<ol>\n<li><strong>You need a <em>package.nw<\/em><\/strong> which is just a <em>.zip<\/em> file with <em>.nw<\/em> extension that contains your project (at least, it needs an <em>index.html<\/em> and a <em>package.json<\/em> inside). The included <em>package.nw<\/em> is just an example using the <a title=\"Yasminoku repository\" href=\"https:\/\/github.com\/jalbam\/yasminoku\" target=\"_blank\" rel=\"noopener\">Yasminoku<\/a> game. Since this is only a port, if you need it you can go to the <a href=\"http:\/\/nwjs.io\/\" target=\"_blank\" rel=\"noopener\">official web site of NW.js<\/a> and read the documentation to know more about <em>package.nw<\/em>, <em>package.json<\/em>, etc.<\/li>\n<li>Optional: <strong>merge <em>nw<\/em> and <em>package.nw<\/em><\/strong> into a single file with the following command:<\/li>\n<\/ol>\n<pre><code>cat nw package.nw &gt; Your_new_binary_file\n<\/code><\/pre>\n<ol>\n<li><strong>Edit <em>fix_libudev.so.0<\/em> and <em>fix_libudev.so.1<\/em><\/strong> and replace <em>Your_new_binary_file<\/em> found in their code by the real name of your binary file (if you did not merge <em>nw<\/em> and <em>package.nw<\/em> together, then replace it by just <em>nw<\/em>).<\/li>\n<li>If you need it, <strong>give executable permissions<\/strong> (and other desired permissions) to <em>Your_new_binary_file<\/em> (or <em>nw<\/em>) using the <strong><em>chmod<\/em><\/strong> command (as root).<\/li>\n<li>Try to <strong>run the binary<\/strong>:<\/li>\n<\/ol>\n<pre><code>.\/Your_new_binary_file\n<\/code><\/pre>\n<p>If you did not merge the <em>nw<\/em> and <em>package.nw<\/em> files in one single file (as explained in <em>step 2<\/em>), you should run this command instead:<\/p>\n<pre><code>.\/nw\n<\/code><\/pre>\n<ol>\n<li>In the case the system complains about <strong><em>libudev.so.0<\/em><\/strong> when you try to run the binary, just type the following command:<\/li>\n<\/ol>\n<pre><code>.\/fix_libudev.so.0\n<\/code><\/pre>\n<p>Likewise, if needed, do the same for <strong><em>libudev.so.1<\/em><\/strong> running this:<\/p>\n<pre><code>.\/fix_libudev.so.1\n<\/code><\/pre>\n<p>Note: these two commands above will only work if you have followed the <em>step 3<\/em> properly before. Each of them only needs to be executed once and never again.<\/p>\n<ol>\n<li>If all works well, you can <strong>distribute your project<\/strong>. You will need these files at least (in the same folder): <em>libffmpegsumo.so<\/em>, <em>nw.pak<\/em> and <em>Your_new_binary_file<\/em> (or <em>nw<\/em> and <em>package.nw<\/em> instead). I would recommend including <em>fix_libudev.so.0<\/em> and <em>fix_libudev.so.1<\/em> optionally (modified as explained in <em>step 3<\/em>) if you think others might need them.<\/li>\n<\/ol>\n<h2>Versions<\/h2>\n<p>node-webkit (now called NW.js) version: v.0.7.0-pre<\/p>\n<p>Node.js version: v0.10.12<\/p>\n<h2>Tested on<\/h2>\n<ul>\n<li>&#8220;<strong>Raspberry Pi Model B<\/strong> Revision 2.0 Mounting holes&#8221; with 512MB RAM (000e revision) using <strong>Raspbian GNU\/Linux 7 &#8220;wheezy&#8221;<\/strong> (Linux raspberrypi <strong>4.1.19+ #858 armv6l<\/strong> GNU\/Linux).<\/li>\n<li>&#8220;<strong>Raspberry Pi 2 Model B<\/strong> PCB Revision 1.1&#8243; with 1024MB RAM (a01041 revision) using <strong>Raspbian GNU\/Linux 8 &#8220;jessie&#8221;<\/strong> (Linux raspberrypi <strong>4.9.35-v7+ #1014 SMP armv7l<\/strong> GNU\/Linux).<\/li>\n<li>&#8220;<strong>Raspberry Pi 3 Model B<\/strong> PCB Revision 1.2&#8243; with 1024MB RAM (a02082 revision) using <strong>Raspbian GNU\/Linux 8 &#8220;jessie&#8221;<\/strong> (Linux raspberrypi <strong>4.1.19-v7+ #858 SMP armv7l<\/strong> GNU\/Linux).<\/li>\n<li>&#8220;<strong>Raspberry Pi Zero W<\/strong> PCB Revision 1.1&#8243; with 512MB RAM (9000c1 revision) using <strong>Raspbian GNU\/Linux 9 &#8220;stretch&#8221;<\/strong> (Linux raspberrypi <strong>4.14.71+ #1145 SMP armv6l<\/strong> GNU\/Linux).<\/li>\n<li>&#8220;<strong>Raspberry Pi 3 Model B+<\/strong> PCB Revision 1.3&#8243; with 1024MB RAM (a020d3 revision) using <strong>Raspbian GNU\/Linux 9 &#8220;stretch&#8221;<\/strong> (Linux raspberrypi <strong>4.14.71-v7+ #1145 SMP armv7l<\/strong> GNU\/Linux).<\/li>\n<li>&#8220;<strong>Orange Pi Zero (Allwinner H2+)<\/strong>&#8221; with 512MB RAM (hardware sun8i, 0000 revision) using <strong>Raspbian GNU\/Linux 8 &#8220;jessie&#8221;<\/strong> (Linux OrangePizero <strong>3.4.39 #2 SMP PREEMPT armv7l<\/strong> GNU\/Linux).<\/li>\n<li>&#8220;<strong>Orange Pi Zero Plus2 (Allwinner H3)<\/strong>&#8221; with 512MB RAM (hardware sun8i, 0000 revision) using <strong>Raspbian GNU\/Linux 8 &#8220;jessie&#8221;<\/strong> (Linux OrangePI <strong>3.4.112-opi #1 SMP PREEMPT armv7l<\/strong> GNU\/Linux).<\/li>\n<\/ul>\n<h2>Compatibility<\/h2>\n<ul>\n<li><strong>Raspberry Pi Zero<\/strong>, all models<\/li>\n<li><strong>Raspberry Pi<\/strong>, all models<\/li>\n<li><strong>Raspberry Pi 2<\/strong>, all models<\/li>\n<li><strong>Raspberry Pi 3<\/strong>, all models<\/li>\n<li><strong>Other devices<\/strong> with compatible hardware (Orange Pi, Banana Pi, etc.)<\/li>\n<\/ul>\n<h2>Credits<\/h2>\n<p>The original binary was shared by <a title=\"piksel's GitHub account\" href=\"https:\/\/github.com\/piksel\" target=\"_blank\" rel=\"noopener\">Nils M\u00e5s\u00e9n &#8220;piksel&#8221; (aka &#8220;spaculo&#8221;)<\/a> at <a href=\"https:\/\/www.youtube.com\/watch?v=MqNUYk9Y8jY\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/watch?v=MqNUYk9Y8jY<\/a> so thank you very much! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is a NW.js (formerly node-webkit) binary compiled for the ARMv6 used by Raspberry Pi. It also runs on Raspberry Pi 2 and Raspberry Pi 3 since they are backward compatible with ARMv6. Other compatible hardware should also be able to run this binary. It can be found on GitHub: https:\/\/github.com\/jalbam\/nwjs_rpi Instructions You need a &hellip; <a href=\"https:\/\/joanalbamaldonado.com\/blog\/2019\/01\/07\/nw-js-port-for-raspberry-pi\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;NW.js port for Raspberry Pi&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52,116,51,65,53,115,50,111,110,9,74,75],"tags":[57,118,56,69,58,117,59,112,113,24,77,76],"class_list":["post-185","post","type-post","status-publish","format-standard","hentry","category-css","category-css3","category-development","category-dhtml","category-html","category-html5","category-javascript","category-node-webkit","category-nw-js","category-programming","category-tool","category-utility","tag-css","tag-css3","tag-development","tag-dhtml","tag-html","tag-html5","tag-javascript","tag-node-webkit","tag-nw-js","tag-programming","tag-tool","tag-utility"],"_links":{"self":[{"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/posts\/185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/comments?post=185"}],"version-history":[{"count":14,"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/posts\/185\/revisions"}],"predecessor-version":[{"id":207,"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/posts\/185\/revisions\/207"}],"wp:attachment":[{"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/media?parent=185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/categories?post=185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joanalbamaldonado.com\/blog\/wp-json\/wp\/v2\/tags?post=185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}