Currently, I get the following error after doing an npm install connect-redis, and using store: new RedisStore in my app.js:
throw e; // process.nextTick error, or 'error' event on first tick
Error: Cannot find module 'connect'
at Function._resolveFilename (module.js:320:11)
at Function._load (module.js:266:25)
at require (module.js:348:19)
at Object. (/Users/rakesh/Projects/asdf/node_modules/connect-redis/lib/connect-redis.js:12:13)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at require (module.js:348:19)
at Object. (/Users/rakesh/Projects/asdf/node_modules/connect-redis/index.js:2:18)
It seems like the error is because require("connect") is used in connect-redis, but it isn't found because I haven't npm installed connect with -g (global install). It's the connect I got with the express deps that's being used.
hmm I haven't used the new npm much, shouldn't it traverse up to the root script and find connect? if not this new npm is not going to work for "plugin" type modules, because if connect is used multiple times multiple patches to node's core are applied causing all kinds of issues (though connect is not the only module with issues like this, many do).
I know having multiple connects running in the same app causes issues because npm wont satisfy the dep with the same exports object even if it could, which then causes some monkey-patches to be applied several times causing all sorts of issues. we use connect-redis though in our app and have connect as a dep in our package.json and things are fine
it certainly is a connect/express etc issue, though a fundamental issue with node modules all together. I can ensure for example that connect will not patch node's core twice, though if you have several versions of connect running, the first will take precedence, which might not always be "right". Regardless with this sort of versioning there will always be issues, it does suck, but I don't see a way around it. From a package management standpoint I understand why npm does what it does, but I'm still not convinced that npm shouldn't satisfy deps in a smart way to reduce these issues, either that or we just have to live with the issues occurring all the time
ah I see though, yeah, with the new npm I guess it can't use the express connect, hmm.. k well guess I will have to add it here, kinda sloppy though since Ideally you want to extend the "main" connect used by express, and for the express plugin mods it just flat-out will not work
added this issue to npm so we can chat about a possible solution npm/npm#930
for now I'll most likely have to expose express.connect and have require('connect-redis')(express.connect) or something ugly like that
Okay, so for now there is no way to use connect-redis via npm, right?!
it does work for us when we add connect to our app's package.json, but yeah I guess I will have to go around and change all these
Implemented require("connect-redis")(connect) for npm 1.x. Closes #23
super lame and ugly :(
Something odd is happening now (with email@example.com) when I install connect via NPM:
UNMET DEPENDENCY redis >= 0.0.1
There is no mention of connect-redis in connect's package.json yet NPM seems to think there is a dependency.
Any clue? I've tried clearing npm cache.
fuck, this is npm's auto bundling thing of libs that are in node_modules but not package.json. I think I saw a commit in npm remove this, not sure, but IMO it should be removed @isaacs
I agree with you, apparently. npm/npm@5f791af
that's awesome. I do have three npm wishes remaining though :-)
The place to discuss those wishes is probably on https://github.com/isaacs/npm/issues, rather than here.