Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
metamindxx opened this Issue · 8 comments

3 participants

@metamindxx

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.

@indexzero
Owner

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

@metamindxx

npm. I installed npm using the "30 second method" (top one at https://gist.github.com/579814).

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

While

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

works fine

@indexzero
Owner

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 http://npmjs.org/install.sh | sudo sh
@metamindxx

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!

@indexzero
Owner

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.

@xrd

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.

Chris

@xrd

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

sudo `which node` app.js -p 80

@indexzero
Owner

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.