Friday, April 13, 2012

Npm Unstable

‹prev | My Chain | next›

Up today, I continue my effort to port express-spdy to the unstable branch of node.js. If at all possible, I would like to avoid the unstable hell I introduced last year.

This may very well be a problem only affects me because I need no fewer than 4 cooperating libraries: express-spdy, connect-spdy, express, and connect. I need to install my local copies because I need to update the node-engines for each. Last year, I published express-unstable and connect-unstable to npm as a workaround. But polluting npm just to suit my development needs is wrong. So, hopefully there is a solution in relative isolation.

If I install with nothing but local packages (e.g. npm install ../express-spdy ../connect-spdy ../express ../connect), I end up with:
➜  express-spdy-test git:(master) ✗ npm ls
application-name@0.0.1 /home/cstrom/repos/express-spdy-test
├─┬ express-spdy@0.1.0 
│ ├─┬ connect-spdy@0.1.0 
│ │ └─┬ connect@1.7.2 
│ │   ├── mime@1.2.4 
│ │   └── qs@0.3.1 
│ ├─┬ express@2.5.0 
│ │ ├── connect@1.7.2 
│ │ ├── mime@1.2.4 
│ │ ├── mkdirp@0.0.7 
│ │ └── qs@0.3.1 
│ └─┬ spdy@0.1.4 
│   └── zlibcontext@1.0.9 
└─┬ jade@0.16.4 
  ├── commander@0.2.1 
  └── mkdirp@0.1.0 
This works, except that when I try to run my app, I get the all too familiar error:
➜  express-spdy-test git:(master) ✗ node app

node.js:247
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Cannot read property 'prototype' of undefined
    at Object.<anonymous> (/home/cstrom/repos/express-spdy-test/node_modules/express-spdy/node_modules/connect-spdy/spdy.js:46:23)
...
This is the result of an incompatible connect underlying library.

I try mucking with npm link, but with similar results. So, in the end, I am stuck with installing from git repos, which I have to add in the various package.json files:
  "dependencies": {
    "connect": "git://github.com/eee-c/connect.git#unstable",
    "commander": "0.5.2",
    "mime": "1.2.5",
    "mkdirp": "0.3.0",
    "debug": "*"
  },
And I end up with the same error... Ugh.

It is as this point that I realize that I have another variable interfering with this install attempt. I am basing the express and connect packages off of the master branches of each. Instead, I need to reset back to the 2.x and 1.x branches respectively.

With that, the install goes through just fine and the server starts without issue. I really wish I had realized that problem earlier.

Still, this is valuable information. I have things more or less working on unstable node.js, but I now know that the upcoming express and connect middleware are incompatible with express-spdy and connect-spdy. I already knew that I needed to get SPDY push into the latest node-spdy and that I would likely need to make changes to both express-spdy and connect-spdy as a result. Now, I know that I also need changes so both packages to accommodate express and connect changes as well.

Day #355

No comments:

Post a Comment