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,
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.
- Download the required package directly from the github repo in .zip format
- Place it in the same folder as the node.exe executable
- 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".
- 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!