将Node.js设置为$ PATH(Ubuntu 12.04) [英] Set Node.js to $PATH (Ubuntu 12.04)

查看:146
本文介绍了将Node.js设置为$ PATH(Ubuntu 12.04)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习RoR,我正在设置这个虚拟机来部署RoR,我被困在Node.js的安装中。



我正在使用Ubuntu 12.04我遵循本指南的这一步:



http:// railsapps.github.com/installing-rails.html


由于Rails 3.1,需要JavaScript运行时才能开发Ubuntu Linux(Mac OS X或Windows不需要)。对于Linux Ubuntu上的
开发,最好安装Node.js
服务器端JavaScript环境:



$ sudo apt-get install nodejs



并将其设置在$ PATH中。


这是什么意思,设置为我的$ PATH?



我一直在谷歌搜索最后几个小时和所有的解决方案是不同的,对于不同的问题,我没有简单的回答。你可以点点光吗?



谢谢!

解决方案

你不需要担心, apt-get install 命令将为您做到这一点。
它将nodejs进程的路径(通常为 / usr / bin / node )添加到全局$ PATH变量中。这确保当您在终端中键入 node 时,它将启动nodejs进程。



如果出于某些奇怪的原因,您无法启动它,则必须手动将节点安装路径添加到$ PATH。您可以通过编辑您的〜/ .bashrc 文件并添加:

  PATH = / usr / bin / node:$ PATH 


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 step of this guide:

http://railsapps.github.com/installing-rails.html

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

and set it in your $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?

Thanks!

解决方案

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

这篇关于将Node.js设置为$ PATH(Ubuntu 12.04)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆