The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Anonymous (122) [Avatar]
#1
Hi.
Thanks for writing this book. As someone who came across node-webkit at about v0.8 and who had no knowledge of node.js or npm or any of that, I wished there was a book like this! So, even though I am reasonably advanced wih nw.js I am following along so I can learn something new.

A couple of suggestions from v1:

1. I use Windows 7 professional to develop then test the result on my Mac. So, on Windows there is no native
touch
command. Probably better to just suggest opening their favourite source code editor and create a new file.

2. When I used
npm install osenv --save
it failed because the version number in the package.json file was "1.0" rather than "1.0.0".

3.
node_modules/.bin/bower install zepto
needs to use backslashes in Windows:
node_modules\.bin\bower install zepto
. Same for the install of lunr.js.

4. Ch3: There is no appendix page yet but the lorikeet png file is in the supplied source code as icon.png. (and... I live in the Blue Mountains west of Sydney and these birds come to my garden! Nice choice. smilie)

I will look at the nwbuilder now but post his much first.

Thanks again,
Murray








Anonymous (122) [Avatar]
#2
The section in the introduction regarding IO.js is out of date.

there is uncertainty over whether IO.js may eventually find itself being merged back into the Node.js
project. There are intentions within the core community of IO.js to eventually see this happen,
but it is too uncertain at this time to guarantee if that will happen.


See http://sdtimes.com/node-js-and-io-js-to-merge-under-node-js-foundation/ for example.
Anonymous (122) [Avatar]
#3
Hi Murray,

Thanks for the suggestions. I've ended up buying a Windows laptop for the book, and came across the issues you mentioned. Amendments have been made for those issues, and pushed up to Manning's internal document management system, so at some point there will be a rejigging.

Chapter 4 on the whole IO.js/Node.js business is being altered to reflect the recent merge of the orgs that oversee them, and the plan to move to a merged codebase. It's annoying that the split/merge happened when it did, but such is life. I remember an old colleague trying to write a book on Merb which got canned when the Merb team merged with the Rails team.

Thanks for the tip on the Lorikeet bird, my girlfriend is from Australia and we saw them flying around a zoo in Queensland when I visited there last year.

Thanks for all the spots and suggestions. Expect an update to the book soon.
murrah (9) [Avatar] Offline
#4
Anonymous wrote:

Thanks for the tip on the Lorikeet bird, my girlfriend is from Australia and we saw them flying around a zoo in Queensland when I visited there last year.

Thanks for all the spots and suggestions. Expect an update to the book soon.


No worries on both counts. smilie

I look forward to learning more about NW.js. I havent had a chance to check out the nwbuilder yet. I have been using a more manual method so look forward to trying nwbuilder instead.

Also, I just wanted to say that there is another advantage of using NW.js for development even if not packaging. I am building a small admin control panel in ExtJS4 that will only be used in a browser for my own use. ie I wont be packaging it with NW.js. The write code/refresh browser/test cycle is pretty slow in development mode when using a normal web browser in ExtJS because it uses a loader/build system to inject script tags for each js file in the MVC. However, if I use NW.js by creating a basic package.json then execute
C:\nw\nw ./
from the same folder as my index.html, my app loads in NW.js in about 3 seconds instead of about 30 due to using the file: protocol instead of the http: protocol! Very useful!

Just thought I'd mention it.

Cheers,
Murray

murrah (9) [Avatar] Offline
#5
Hi.
I am following the instructions for nwbuilder.

1. It seems that node-webkit-builder has been renamed so the npm install should now be:
npm install nw-builder -g


2. When I execute the win64 version of lorikeet.exe (I am using Win7 Professional on x64 pc), after a pretty long delay I get the nw.js "default grey screen", not the app. The app works fine if I execute it by running
C:\nw\nw ./
but not once it is built. I was wondering whether you had tested the instructions on your new Windows machine yet?

3. Also, nwbuilder includes the bower modules in its build since bower is loaded in the app's node_modules folder beside async and osenv. That might also explain the slow load time? I couldnt find a way to exclude bower from the build without (maybe) using gulp which I have never used either.

So, can you let me know whether you had success by following the book in your Windows machine please? If so, I will double check (again!) to see what I might have done wrong.

Thanks,
Murray



murrah (9) [Avatar] Offline
#6
Hi Paul.

From a Mac noob perspective:
I develop on Windows then package for Mac (the opposite of you, I take it).
Since I had trouble using the nwbuilder on Windows I thought I would test your book by developing on my Mac. What I encountered as a relatively new Mac user:

1.
npm install -g nw
threw an EACCES error "Please try running this command again as root/Administrator" which I already was doing. The fix to this problem is here: https://aralbalkan.com/scribbles/npm-install-g-please-try-running-this-command-again-as-root-administrator/


2. There is an issue when exploring files with nw.js on a Mac that seems unresolved. I have the completed lorikeet app running beautifully. If I use lorikeet to navigate to a folder containing an application, the .app file appears as a folder, and if I double click it it opens the package / directory, rather than launching the app. I am using nw.js v0.12.2. I encountered this issue in my own nw.js app some time ago. Do you know whether the issue has been resolved eg in v13? Or do you have a workaround / fix?

Thanks,
Murray
murrah (9) [Avatar] Offline
#7
murrah wrote:2. There is an issue when exploring files with nw.js on a Mac that seems unresolved. I have the completed lorikeet app running beautifully. If I use lorikeet to navigate to a folder containing an application, the .app file appears as a folder, and if I double click it it opens the package / directory, rather than launching the app. I am using nw.js v0.12.2. I encountered this issue in my own nw.js app some time ago. Do you know whether the issue has been resolved eg in v13? Or do you have a workaround / fix?


I asked a StackOverflow question and got 2 helpful responses on this issue:
http://stackoverflow.com/questions/31741977/node-js-io-js-osx-how-to-check-whether-a-filepath-target-is-an-application-pa.

I implemented a quick and dirty solution to simply turn any application packages into files instead of folders. Amended fileSystem.js attached FYI. smilie
paulbjensen (39) [Avatar] Offline
#8
Hi Murray,

Thanks for the forum messages.

1. It seems that node-webkit-builder has been renamed so the npm install should now be:
1
npm install nw-builder -g


Yeah, I've updated the documents to reflect the renaming of the builder library.

2. When I execute the win64 version of lorikeet.exe (I am using Win7 Professional on x64 pc), after a pretty long delay I get the nw.js "default grey screen", not the app. The app works fine if I execute it by running
1
C:\nw\nw ./
but not once it is built. I was wondering whether you had tested the instructions on your new Windows machine yet?


Yes, I ran into this problem on the Windows machine following my instructions, and it is to do with having bower installed as a local dev dependency. Windows can only handle file paths that are no longer than 255 characters, and because some of the dependencies in bower have file paths longer than this, it causes the grey screen issue.

I've resolved the issue by having bower installed as a global dependency and not including it in the node_modules folder. I've updated the book's instructions, and also added a sidebar on the Windows 255 character limit on file paths, as it's quite a bad gotcha.

3. Also, nwbuilder includes the bower modules in its build since bower is loaded in the app's node_modules folder beside async and osenv. That might also explain the slow load time? I couldnt find a way to exclude bower from the build without (maybe) using gulp which I have never used either.


Got rid of bower as a dev dependency, so this issue should go away.

Another note on the Windows machines is that some of the command line instructions use forward slashes, where Windows uses backslashes as the path separator. I've updated any command line instructions to make sure that they're compatible with both Mac and Windows.

1.
1
npm install -g nw
threw an EACCES error "Please try running this command again as root/Administrator" which I already was doing. The fix to this problem is here: https://aralbalkan.com/scribbles/npm-install-g-ple...d-again-as-root-administrator/


The cause of that problem is if you install Node.js in your /usr/local folder on Mac. I use a tool called NVM (Node.js version manager - github.com/creationix/nvm), which allows you to install and switch between multiple versions of Node.js (0.10, 0.12, and even io.js). Because this installs node in a local user space, you don't run into any administration access errors. I recommend using nvm over doing an installation of Node.js via their mac .dmg.

2. There is an issue when exploring files with nw.js on a Mac that seems unresolved. I have the completed lorikeet app running beautifully. If I use lorikeet to navigate to a folder containing an application, the .app file appears as a folder, and if I double click it it opens the package / directory, rather than launching the app. I am using nw.js v0.12.2. I encountered this issue in my own nw.js app some time ago. Do you know whether the issue has been resolved eg in v13? Or do you have a workaround / fix?


Yes, you're right I didn't handle .app files, good spot. Technically they are folders, but it would be good to handle double-clicking on them.

Thanks for the addition to the files you made, I will include it into the book, with a small adjustment of making the fs.readFileSync use fs.readFile instead (doesn't block the event loop and thus is quicker), but yes this is a great spot, thank you.
murrah (9) [Avatar] Offline
#9
nwbuildMac.js
[ 428 bytes ]
Thanks for your update and suggestions Paul. I will adjust my code and test again. I had great success with nw-builder on my Mac and used it to build a fairly large nw.js / ExtJS project successfully. I look forward to replicating that on my Windows machine to improve my workflow.

I also went down the
$ node nwbuild.js
way of using nw-builder so i could exclude files and folders that I didnt want to include in the build. All good. I have included the build.js I used for Lorikeet on the Mac FYI. Something like that in Ch1 might help others with learning about this (IMJ) more useful and pretty simple way of executing nw-builder.

Thanks again,
Murray