linux - Setting node path and allowing to run as sudo

07
2014-07
  • pedalpete

    I've got a raspberry pi that I'm running node on. I followed this guide http://joshondesign.com/2013/10/23/noderpi to install node.

    When I setup the NODE_JS_HOME, I can run node from the command line, but not sudo node, and I need to be sudo to access GPIO.

    I also seem to need to re-enter the NODE_JS_HOME in my .bash_profile every time I open a new terminal window. I'm hoping that I can set node globally and be able to run sudo node form the command line, right from start-up.

  • Answers
  • fede.evol

    Try setting the NODE_JS_HOME variable in your /etc/profile file. That file contains system wide settings that will therefore be applied to every shell execution.

  • pedalpete

    I ended up uninstalling node and re-installing via

    wget http://node-arm.herokuapp.com/node_latest_armhf.deb
    sudo dpkg node_latest_armhf.deb
    

    After that sudo node ran perfectly, without having to set-up any profiles


  • Related Question

    linux - add directory to sudo path on wubi
  • patrickinmpls

    I'm using wubi ubuntu which doesn't have a root account. I have php in a nonstandard location because of lamp. I would like to add a path to the sudo account so I can do sudo php -m for example.


  • Related Answers
  • Dennis Williamson

    Will it work if you add it to /etc/profile or /etc/bash.bashrc?

    What does your /etc/sudoers file look like?

  • muntoo

    I used this:

    sudo su --c "php -m"