Setting NODE_PATH on Windows

If your getting errors like ‘cannot find module x’ when trying to start a nodejs server on windows then you probably have some code which is looking for node modules but they are not being found. This could be a number of reasons but node will look in the default folders for the module and …

npm install error

I have no idea why the install of npm is failing. There is nothing online about this error so here it is. “AgentSSL.prototype.addRequest” -> “TypeError: Cannot read property ‘prototype’ of undefined”. I’ve tried to install npm using the following with no luck (as suggested). curl https://npmjs.org/install.sh | sh curl https://npmjs.org/install.sh | sudo sh git clone …

Node.js Get the Curent URL and Params

In your server code use the following to display the current URL and params. // API / GET exports.get = function( req, res ) {      var fullUrl = req.protocol + ‘://’ + req.get(’host’) + req.originalUrl;      res.send(fullUrl);      return true; } Or you can display the headers of the request like …

NODEJS COMMAND Shorthands

Official NODEJS COMMAND Shorthands. I found these when taking a look at the utils source code. Lovin the -gangsta one haha! exports . shorthands =    { s : [ "–loglevel" , "silent" ]    , d : [ "–loglevel" , "info" ]    , dd : [ "–loglevel" , "verbose" ]    , ddd …

cannot find module ‘jsdom’

An error I came across when trying to install jsdom npm package on my windows machine. “cannot find module ‘jsdom’. Solutions: 1. Follow instructions on this blog post to get jsdom working on windows. http://www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/ 2. Use an alternative (lighter) package called Cheerio. Notes: Something I ran into was this error when using cheerio. “cheerio …