将 Node.js 设置为 $PATH [英] Set Node.js to $PATH
问题描述
我正在研究 RoR,我正在将此虚拟机设置为部署"RoR,但我在 Node.js 安装中陷入困境.
I am studying RoR and I am setting this virtual machine to "deploy" RoR and I got stuck in the Node.js installation.
我使用的是 Ubuntu 12.04,我遵循了本指南的这一步:
I am using Ubuntu 12.04 and I followed this step of this guide:
http://railsapps.github.com/installing-rails.html
从 Rails 3.1 开始,在 Ubuntu Linux 上开发需要一个 JavaScript 运行时(Mac OS X 或 Windows 不需要它).为了在 Linux Ubuntu 上开发,最好安装 Node.js服务器端 JavaScript 环境:
Since Rails 3.1, a JavaScript runtime has been needed for development on Ubuntu Linux (it is not needed for Mac OS X or Windows). For development on Linux Ubuntu, it is best to install the Node.js server-side JavaScript environment:
$ sudo apt-get install nodejs
并将其设置在您的 $PATH 中.
and set it in your $PATH.
设置为我的 $PATH"是什么意思?
What does it mean, "set to my $PATH"?
过去几个小时我一直在谷歌上搜索它,所有解决方案都不同,针对不同的问题,我没有得到简单的答案.你能在这里给点光吗?
I've been searching for it on google in the last couple of hours and all solutions are different, for different problems and I get no simple answer for that. Can you give a little light here?
谢谢!
推荐答案
你不必担心这个,apt-get install
命令会为你做到这一点.它将 nodejs 进程的路径(通常是 /usr/bin/node
)添加到全局 $PATH 变量中.这确保当您在终端中键入 node
时,它将启动 nodejs 进程.
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.
如果由于某种奇怪的原因无法启动它,则必须手动将节点安装的路径添加到 $PATH.您可以通过编辑 ~/.bashrc
文件并添加:
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
这篇关于将 Node.js 设置为 $PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!