Node.js on Windows: Who Needs NPM?

So last night via DZone I get word that Node.js had released a Windows version of the popular Javascript based server environment around the 14th of July. Checking from their site, version 0.5.2 was out, being the second currently unstable release for Windows at the moment. I could not hold back my excitement as I do not run Linux, and we use Node.js extensively in my workplace. I just had to try it.

Setting It Up

So in a matter of minutes, the 9.8MB “node.exe” download was on my system, and without even reading any blogs or instructions, I just knew I had to  setup my Windows CMD Environment variables to point to this executable so I could use it from any folder I wished.

And just like a typical Ghanaian who does not read instructions, I jumped straight at the opportunity to run our socket server we were using in the project. That is when all hell broke loose, at least for a few minutes.

The culprit? Missing packages and libraries. I half expected that, just wanted to try without them for the fun of it.

So the next step, find and download the needed libraries. What are they? Just two actually,

  1. Node MySQL Native
  2. Socket.io

Easy peasy, so how do you download them for use by Node on Windows? In Linux I would setup NPM (Node Package Manager) and easily execute a call like

npm install mysql

to get a mysql package from the online repo. But I don’t have NPM on Windows, because apparently the current  version does not support child_process.spawn. That’s a bummer. So how do you do get it run.

The Steps

  1. Download the required package directly from the github repo in .zip format
  2. Place it in the same folder as the node.exe executable
  3. Unpackage the archive and rename the contained folder it as it would have been named if it were to be downloaded via npm. In the case of the mysql package, I renamed the folder from “felixge-node-mysql-6a40e53” to simply “mysql”.
  4. That’s all

Who needs NPM on Windows. Here are the packages downloaded

Btw, I had issues when trying to install socket.io. Apparently, our company is running version 0.6.2 and the current version from the repo is 0.7.7 which depends on three extra packages in order to run. I had to revert and download the 0.6.2 package in order for things to work.

Happy Node Development y’all!

My First Blue Screen Of Death On Windows 7

Nice to know Windows will always be windows. I say this because just recently I had my first Blue Screen of Death. After almost 3 months of using my fresh new laptop without a hassle, Windows finally choked and gaggled, and finally collapsed on me with a non-fatal stroke. But before you go bashing Windows for being a crappy OS, I must say that this was really my fault to some extent, and I am proud of it. So what did I do? I simply pushed the OS to it limits and it had to choke. Here is the list of applications and peripherals running at the time of the crash: Continue reading My First Blue Screen Of Death On Windows 7