nginx reload breaks node install

Hey, everyone,

I followed the linode documentation on NGINX + NODE (such an easy walkthrough, by the way!) and successfully set everything up.

However one thing I noticed is that whenever I change my sites-available file and reload the server (sudo service nginx reload) the bash can't find 'node' anymore. Re-running (nvm install 0.10) fixes this, but that's going to get annoying really quickly.

Any suggestions?

1 Reply

So I think I have more information here.

It could be related to missing environment PATH locations.

I think that NPM was not installed in the root, so I can't run the command without sudo, but sudo won't find the correct path because it's looking in the root.

The workaround was to use:

sudo env "PATH=$PATH" npm install

But this is still just a hack.

This same issue resurfaced elsewhere.. when I was trying to install a node-gyp module, the npm install failed because I was using sudo. I read that I had to add the extra flag:

sudo env "PATH=$PATH" npm install –unsafe-perm

But it's still not working for me, and I'm dead in the water without being able to run my app.

Any thoughts?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct