Skip to content


Subversion checkout URL

You can clone with
Download ZIP


I get "Error: Cannot find module 'pool' " when running with sudo #17

metamindxx opened this Issue · 8 comments

3 participants


I got the proxy working with high numbered ports. When using port 80 I (think I) have to use sudo and I then get the error mentioned in the title.


Did you install pool via npm? Are you doing installations via npm with sudo? Not that you have to, but I know there are some issues around doing that.

I currently sudo my npm installations, so that might be the problem


npm. I installed npm using the "30 second method" (top one at

I just tried, and got (i'm a bit of a unix newbe):

:~/node-latest-install$ sudo npm install http-proxy

sudo: npm: command not found


:~/node-latest-install$ npm install http-proxy

works fine


Right. That means that npm isn't installed for the root user, so the packages aren't getting loaded from the correct paths when you run a script using http-proxy with sudo. I'm not sure the right approach here honestly.

Maybe try this:

  curl | sudo sh

OK. That seems to have done the trick. I did get a bit of this sort of stuff though:

npm ERR! sudon't! Running npm as root is not recommended!

npm ERR! sudon't! Seriously, don't do this!

npm ERR! sudon't!


Yeah, it's true that it's not recommended, but that's just because isaacs hasn't gotten around to improving safe execution under sudo. He will eventually.


I think a good way to do this is run node with an absolute path:

sudo which node ./connect -p 80

This allows you to use port 80, but does not require you to hardcode the path. And, it will use whatever version of node you are currently using under nvm.



Hmm, did not come through in markdown. Here is a better version.

sudo `which node` app.js -p 80


Nice. I'll try that out. Although it shouldn't it never be run as root and really be an IP Tables setup?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.