small medium large xlarge

25 Apr 2017, 06:03
Wesley Davis (1 post)

I’ve got yet another clean install with problems building native modules (node-gyp). I’ve seen problems on Centos (try installing an Oracle Driver) with node-gyp, which doesn’t install properly - and it’s similar on Windows 10. Configuration is 10-x64, latest updates, Python 2.7 (whatever the latest 2.7x is), Visual Studio 2017 Community with its latest updates.

I’m not going into the details - I see dozens of postings all over the place with the exact same error messages and many ways to solve it none of which work - for me or the person posting (but it worked for someone else). I’ve never seen failures in what should be simple software installations like I’ve seen with Nodejs native modules (PKI infrastructure aside, but that is to be expected). It should have been fixed 5 years ago by the node teams, but they never bothered to come up with a good solution, and when something fails, it always leaves a mess behind that can take some serious system admin sleuthing to install. It is never a matter of just putting python in the path properly, no matter how many times that is suggested.

So this book is quickly into zmq which is a native module and, yes, once again, node-gyp suddenly doesn’t work and nothing fixes it and zmq can’t be installed and more than half of the book is worthless.

I also have zero interest in anything that requires “–harmony” to run. So older node versions are out. The node folks say 7.9 is stable, maybe it isn’t. but 6 is too far behind. I’m running win 10 and Visual Studio 2017 - which has phenominal support, much better than the 3 or probably 4 IDEs I tried on Linux (the only 2 I remember are Komodo and VS Code). That was a while back and I’m not a fan of the “beat head against wall” that Linux requires, either. The order of magnitude better support in VS 2017 Community for Node/MEAN work leaves it a non-option to switch to Linux.

So the problem is really “how to use the book” for the 2/3 that requires native modules? I don’t have a simple answer. Yes, I’ve tried all manner of removal and re-try, built-in package manager or native command line (admin level launch) - it’s all the same, down to the character, but that’s what I’d expect since it’s all just piped anyway.

The microsoft docs for setting up a node environment, is not helpful either and is a generation too old (VS 2015).

MY WISH: Never -EVER- put anything in a book that requires node-gyp (native modules). It is too problematic and fundamental issues. And don’t do the tired practice common to most books of bringing in 3rd party libraries which only complicate sorting out what is node and what is something else. I’ve seen that so much in the java world over the years. Someone writes a book for an open source thing and immediately starts in with “I’m so smart I always use these 10 other libraries so I’m including them in the examples” - which leaves the reader confused about what is 3rd party and what is the subject of the book. While this book isn’t that bad, it isn’t good either.

All I want is to follow some of the topics - and I don’t need all of the network plumbing, I simply want to add to my basic MEAN work from the past to more thoroughly take advantage of node’s capabilities.

Any suggestions?

It looks like I’ll be going to some other sources for a good walk through of features in MEAN I haven’t used yet. I put in my one-star rating on Amazon.

25 Apr 2017, 20:57
Jim R. Wilson (87 posts)

Hi Wesley,

I’m sorry, and thanks so much for taking the time to write up these comments. You think I’m an arrogant, uncaring author. I’m really sorry about the node-gyp trouble on Windows! The one-star rating hurts, but I understand you’re extremely frustrated.

If it’s any help, that is the only chapter that requires native modules—the rest is JS-only. You may benefit from skipping to the next chapter.

It looks like I’ll be going to some other sources for a good walk through of features in MEAN I haven’t used yet.

Sorry, it wasn’t my intention to do a MEAN book, and I’m doubly sorry if any of the materials lead you to think that it was. I do cover Express and Node, but not the MEAN stack.

To your point about not mixing the core technology with the modules, I totally share your viewpoint! It’s actually for that reason that I chose to write about CouchDB rather than MongoDB. I felt that readers would benefit from an introduction to REST semantics by using a RESTful database before creating their own APIs.

Same thing with Angular. I understand that some people like it a lot, but the same is true of other frameworks. Currently React is also popular, but in years past it has been Backbone, Ember, etc. I prefer to give readers framework-agnostic advice that they can carry on to whichever framework they choose (or none at all).

Regarding --harmony flags, I agree wholeheartedly. Four years ago, when I was writing this book, that was the only way to get many features that are now the gold standard (like const and let). The examples were written largely for Node 0.10.x—if you are running 4.x or higher, you almost certainly don’t need the flag.

I’m currently working on a second edition titled Node.js 8 the Right Way. It addresses many of your criticisms of the first edition, as well as being updated for the soon-to-be-released features of Node.js 8. In many ways, it’s the book I wish I could have written all along, now that the underlying v8 engine has caught up with ECMAScript 2015 and beyond.

I’ll caution you though, the new edition makes even more use of external, third-party modules than the first edition did. For a few examples, the new edition walks through setting up unit test suites with Mocha and Chai, as well as using webpack with TypeScript to transpile your frontend code. Rather than hit CouchDB, it works with Elasticsearch, and makes frequent use of the non-Node command line tool, jq.

In the mean time, if you’re just looking to get better at MEAN, then I can recommend a few topics specific to Node.js that you might find valuable to research:

  • Promises - These have become far and away the dominant paradigm for consolidating synchronous and asynchronous code flows (aside from the Node.js core modules).
  • async/await - Node.js 8 has native support for async functions, which allow a more natural mixing of synchronous and asynchronous code via Promises.
  • TypeScript - Even if you don’t decorate your own code with typings, the compile-time static analysis can help you detect subtle bugs early.
  • Modern ES features - A boat load of new features have become available since the first edition. My favorites include arrow functions, destructuring assignment, rest/spread parameters, default parameters, and computed property names.

Anyway, these are a few things off the top of my head. Hope it helps!

In any case, I hope you’ll consider checking out the rest of the book. Thanks again for your advice!

You must be logged in to comment