title: On EC2: sudo node command not found, but node without sudo is ok
body: <p>I have just installed nodejs on a new EC2 micro instance.</p>
  
  <p>I installed it normally, ./configure -> make -> sudo make install.</p>
  
  <p><strong>Problem:</strong> When I run "node" under ec2-user, it runs perfectly. When I run "sudo node", it fails.</p>
  
  <p>I found out that node is in:</p>
  
  <pre><code>[ec2-user@XXXX ~]$ whereis node
  node: /usr/local/bin/node /usr/local/lib/node
  </code></pre>
  
  <p>and the current path is</p>
  
  <pre><code>[ec2-user@XXXX ~]$ echo $PATH
  /usr/local/bin:/bin:/usr/bin:/opt/aws/bin:/home/ec2-user/bin
  </code></pre>
  
  <p>but, the sudo path is</p>
  
  <pre><code>[root@ip-10-112-222-32 ~]# echo $PATH
  /usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin
  </code></pre>
  
  <p>then I tried to edit the root PATH to include the paths to node, so "node" runs when I'm logged in as root - but it still won't work when I log in as ec2-user and run "sudo node".</p>
  
  <p>I need this to install npm properfly. Any idea on how to include the node path while running "sudo node"?</p>