3

I just installed node by cloning the git repo + make && make install. I then installed npm, and used npm to install express (seems like it fetches Connect automatically since it's a dependency). However, when trying to start a simple express example I get the error message:

Error: Cannot find module 'connect/utils'
at Function._resolveFilename (module.js:219:11)
at Function._load (module.js:171:25)
at require (module.js:246:19)
at Object.<anonymous> (/home/yngve/local/node/lib/node/.npm/express/1.0.3/package/lib/express/response.js:16:13)
at Module._compile (module.js:302:26)
at Object..js (module.js:308:10)
at Module.load (module.js:234:31)
at Function._load (module.js:201:10)
at require (module.js:246:19)
at Object.<anonymous> (/home/yngve/local/node/lib/node/.npm/express/1.0.3/package/lib/express/index.js:52:1)

It seems someone has the same problem here: http://groups.google.com/group/express-js/browse_thread/thread/287086bd30f79cf1/adbb5c669872e45a but the conclusion seems to be that one needs connect installed (which I have). I've checked that I have the following files at least:

/home/yngve/local/node/lib/node/.npm/connect/0.5.8/package/lib/connect/utils.js /home/yngve/local/node/lib/node/.npm/express/1.0.3/node_modules/connect/connect/utils.js

Anyone have a clue?


Resolved

Added

require.paths.unshift('<path_to_node>/lib/node/connect');

But the newest rev. is fixed, so this shouldn't really be necessary (see answer below).

2 Answers 2

4

It seems like it was a bug in express. Installing the latest version, 1.0.5, fixed this problem for me.

Sign up to request clarification or add additional context in comments.

1 Comment

FYI: Express 1.x isn't compatible with with node 0.4; you'll need to either back Node up to 0.2.6, or install Express 2.0-pre
0

It sounds like you don't have your require path including your npm directory. Use require.paths to modify that.

Some more info:

http://jherdman.github.com/2010-04-05/understanding-nodejs-require.html

1 Comment

It would be nice to have excerpts from the linked document in case it disappears one day.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.