Thursday, 19 July 2012

Node js: TypeError: Cannot read property 'prototype' of undefined at Object. (/http.js:49:35)

So I'm deploying my node app to the OpenStack framework using AppFog, but unfortunately even if you supply a package.json specifying your dependencies, you still need to manually copy over the files from your .npm directory
TypeError: Cannot read property 'prototype' of undefined at Object. (/http.js:49:35)

So I started copying over the dependencies manually, ie.


tchan@tommy:~/repo/afbirthday$ cp -a ~/.npm/cssom/0.2.4/package node_modules/cssom


I got to copying over express and its dependencies, and I had two versions of connect I could choose from. Naturally I chose the latest one, which turned out to be a bad idea when I tried to deploy the app.

I searched through forums, and eventually I came across a niffy feature of npm, which allows you to see the dependent versions of your dependencies.

npm ls

You will then see what version of connect is required by express. Turns out I used the newer version, which was causing issues.

Lesson of the day...use npm ls to see what versions your dependencies are before copying shiet over!

No comments:

Post a Comment