Set Node.js to $PATH

后端 未结 4 2058
庸人自扰
庸人自扰 2020-12-29 06:07

I am studying RoR and I am setting this virtual machine to \"deploy\" RoR and I got stuck in the Node.js installation.

I am using Ubuntu 12.04 and I followed this st

相关标签:
4条回答
  • 2020-12-29 06:33

    I restarted Ubuntu after the install. That fixed the issue for me.

    0 讨论(0)
  • 2020-12-29 06:35

    Depending on which shell you are running, the answer may be different, but a good starting place might be http://www.troubleshooters.com/linux/prepostpath.htm

    And http://www.linuxjournal.com/article/3645

    0 讨论(0)
  • 2020-12-29 06:41

    You don't have to worry about that, the apt-get install command will do that for you. It adds the path to the nodejs process (usually /usr/bin/node) to the global $PATH variable. This ensures that when you type node in your terminal it will start the nodejs process.

    If for some weird reason you cannot start it, you'll have to manually add the path to your node installation to the $PATH. You can do this by editing your ~/.bashrc file and adding:

    PATH=/usr/bin/node:$PATH
    
    0 讨论(0)
  • 2020-12-29 06:47

    I've been trying to install npm and it has complained about node not being in the path. Funnily enough, nodejs was, but node wasn't. I ended up solving the problem thus:

    $ cd /usr/bin/
    $ sudo ln -s nodejs node
    

    ...which symlinks node to nodejs. Now npm installs without complaints.

    0 讨论(0)
提交回复
热议问题