Up today, I finally get back to SPDY. Specifically, I need to get express-spdy back to some sane dependencies.
It has been a while, so I download and install the latest, stable version of node.js:
➜ src tar zxf ~/Downloads/node-v0.6.15.tar.gz
➜ src cd node-v0.6.15
➜ node-v0.6.15 ./configure \
--openssl-includes=$HOME/local/include \
--openssl-libpath=$HOME/local/lib \
--prefix=$HOME/local/node-v0.6.16
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for gcc : ok
Checking for library dl : yes
Checking for function SSL_library_init : yes
Checking for header openssl/crypto.h : yes
Checking for library util : yes
Checking for library rt : yes
Checking for fdatasync(2) with c++ : yes
'configure' finished successfully (1.015s)
➜ node-v0.6.15 make
Waf: Entering directory `/home/cstrom/src/node-v0.6.15/out'
DEST_OS: linux
DEST_CPU: x64
Parallel Jobs: 1
Product type: program
[ 1/35] copy: src/node_config.h.in -> out/Release/src/node_config.h
...
Waf: Leaving directory `/home/cstrom/src/node-v0.6.15/out'
'build' finished successfully (6m46.929s)
-rwxrwxr-x 1 cstrom cstrom 11M 2012-04-10 22:26 out/Release/node
➜ node-v0.6.15 make install
...
'install' finished successfully (0.632s)Then do the same for npm:➜ express-spdy git:(master) curl http://npmjs.org/install.sh | sh ... install npm@1.1 fetching: http://registry.npmjs.org/npm/-/npm-1.1.16.tgz 0.6.15 1.1.16 cleanup prefix=/home/cstrom/local/node-v0.6.16 All clean! /home/cstrom/local/node-v0.6.16/bin/npm -> /home/cstrom/local/node-v0.6.16/lib/node_modules/npm/bin/npm-cli.js npm@1.1.16 /home/cstrom/local/node-v0.6.16/lib/node_modules/npm It workedBut, when I try to install express-spdy, I get:
➜ express-test npm install ~/repos/express-spdy/
...
npm ERR! error rolling back express-spdy@0.1.0 Error: ENOTEMPTY, rmdir '/home/cstrom/tmp/express-test/node_modules/express-spdy'
npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: spdy@1.2.0
npm ERR! Required: ["node ~ 0.7.0"]
npm ERR! Actual: {"npm":"1.1.16","node":"0.6.15"}
...Bad maintainer! Bad!Fortunately, this turns out to be a simple matter of pegging express-spdy (and connect-spdy) to stable versions of node-spdy (the parsing module that sits underneath express-spdy). In the
package.json file for each, I keep node-spdy under version 1.0:{
"author": "Chris Strom (http://eeecomputes.com)",
"name": "express-spdy",
"description": "SPDY-ize express.js sites.",
// ...
"dependencies": {
"express": ">= 2.5.0",
"connect-spdy": ">= 0.1.0",
"spdy": ">= 0.1.0 < 1.0.0"
},
// ...
}
That seems to be enough, because I can now install locally:➜ express-test npm instal/ ~/repos/express-spdy/ npm http GET https://registry.npmjs.org/connect-spdy npm http GET https://registry.npmjs.org/express npm http GET https://registry.npmjs.org/spdy npm http 304 https://registry.npmjs.org/express ... express-spdy@0.1.0 ./node_modules/express-spdy ├── spdy@0.1.4 (zlibcontext@1.0.9) ├── connect-spdy@0.1.1 (connect@2.1.0) └── express@2.5.9 (qs@0.4.2, mime@1.2.4, mkdirp@0.3.0, connect@1.8.6)I follow the INSTALL instructions for configuring the express-spdy server and fire up the app only to find:
➜ express-test node app
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (/home/cstrom/tmp/express-test/node_modules/express-spdy/node_modules/connect-spdy/spdy.js:46:23)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/home/cstrom/tmp/express-test/node_modules/express-spdy/node_modules/connect-spdy/connect.js:2:18)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)Ugh. Can't read prototype of unknown? That line refers to HTTPServer, how can it be unknown? The answer is that I have one too many HTTPServers installed by virtue of two different connect packages:├─┬ express-spdy@0.1.0 │ ├─┬ connect-spdy@0.1.1 │ │ └─┬ connect@2.1.0 │ │ ├── crc@0.1.0 │ │ ├── debug@0.6.0 │ │ ├── formidable@1.0.9 │ │ ├── mime@1.2.4 │ │ └── qs@0.4.2 │ ├─┬ express@2.5.9 │ │ ├─┬ connect@1.8.6 │ │ │ └── formidable@1.0.9 │ │ ├── mime@1.2.4 │ │ ├── mkdirp@0.3.0 │ │ └── qs@0.4.2 │ └─┬ spdy@0.1.4 │ └── zlibcontext@1.0.9 ....So I peg connect-spdy to the connect being used by express.js:
{
"author": "Chris Strom (http://eeecomputes.com)",
"name": "connect-spdy",
"description": "SPDY-ized connect server.",
// ...
"dependencies": {
"connect": ">=1.7.0 <1.9.0",
"spdy": ">=0.1.0 < 1.0.0"
},
// ...
} In the interest of future-proofing things, I also peg express-spdy to the current version of express.js. After re-installing, I only have one connect.js installed:├─┬ express-spdy@0.1.2 │ ├─┬ connect-spdy@0.1.2 │ │ └─┬ connect@1.8.6 │ │ ├── formidable@1.0.9 │ │ ├── mime@1.2.5 │ │ └── qs@0.4.2 │ ├─┬ express@2.5.9 │ │ ├─┬ connect@1.8.6 │ │ │ └── formidable@1.0.9 │ │ ├── mime@1.2.4 │ │ ├── mkdirp@0.3.0 │ │ └── qs@0.4.2 │ └─┬ spdy@0.1.4 │ └── zlibcontext@1.0.9 ...And my server now starts:
➜ express-test node app Express server listening on port 3000 in development modeMore importantly, I can again start up a SPDY session and verify that it is, indeed, SPDY via chrome://net-internals/#spdy:
Yay! It feels good to be back. I publish updated NPM packages for express-spdy and connect-spdy and call it a night.
Day #352

No comments:
Post a Comment