New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web_server.js: Cannot find module 'redis' #37
Comments
You need to install the library into your path somehow. I use npm. So from the top level node_redis dir, do:
It'll install node_redis using the local git repo as the source instead of the npm server's version. |
sorry to be dim, but what |
It's worth taking the time to figure out npm. Many node libraries only work properly from npm. Until you get npm working, you can modify the examples to do:
instead of
|
result: permission denied successfully installed npm in ~/local/bin as per your instruction: but: node.js:63 the redis aspect is escaping me... mac-mini:~ jaymini$ when I had tried to install it from within redis: mac-mini:redis jaymini$ ~/local/bin/npm install |
This looks like more of an npm issue. You can often find isaacs on freenode IRC, channel #node.js. That's often the fastest way to fix npm issues. If he's not there, sending email to the npm google group address is another way to get support. |
as he says there's no package.json in the folder: but I'm not clear what to do next... |
Hmm, that's odd. There is certainly a package.json file in the git repo:
And also: https://github.com/mranney/node_redis/blob/master/package.json |
yes, but isn't that in node_redis, not redis? |
ie as per issue description: Cannot find module 'redis' |
The project and repo are called "node_redis", but in npm it is called "redis". This means that you require "redis" and "npm install redis". If you want to install from git, you can check out the repo named "node_redis". From within that "node_redis" directory, you can do "npm install" and it should install properly. |
BTW, are you using node and npm from homebrew? The homebrew installation seems to really confuse npm. |
no homebrew, but stumped, you'll understand my confusion over redis, |
Yeah, that's why I think this is an npm issue. Something about npm on your machine is confused. I suggest removing all traces of npm and node and install both again. Either that, or you can figure out what, exactly, is broken with npm on your computer, but starting over is probably easier. It should look like this when you install and test: mjr:~/work/node_redis (master)$ npm install mjr:~/work/node_redis (master)$ node
|
I should add that you probably shouldn't install the git version at all if you aren't making changes. Just get a fresh install of node and npm, and then do:
And you should be able to require("redis"). |
ok well it's getting late, so in the morning.. will delete and start again! probably want to fork node_redis, |
tx again |
OK, cool. Good luck. |
all-working now! had not appreciated that npm used /usr/local/node, before /local/node best! |
after I enter the command node server.js to make localhost, after I stabbed the command it comes out immediately. -------------------------------------Starting server---------------------------------------------------- internal/modules/cjs/loader.js:783 Error: Cannot find module 'redis-server'
|
node v0.3
redis v2.2 antirez git
wfm most test.js
at resolveModuleFilename (node.js:265:13)
at loadModule (node.js:231:20)
at require (node.js:291:14)
at Object. (/Users/jaymini/node_redis/examples/web_server.js:4:20)
at Module._compile (node.js:348:23)
at Object..js (node.js:356:12)
at Module.load (node.js:279:25)
at Array. (node.js:370:24)
at EventEmitter._tickCallback (node.js:42:22)
at node.js:634:9
The text was updated successfully, but these errors were encountered: