therubyracer或nodejs,我应该使用哪个? [英] therubyracer or nodejs, which should I use?

查看:128
本文介绍了therubyracer或nodejs,我应该使用哪个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在新安装的Ubuntu 12.10上关注 ruby​​ on rails入门指南 。我要运行 rake db:create 但是我收到以下错误:

I am following the ruby on rails getting started guide on a new install of Ubuntu 12.10. I'm up to running rake db:create but I get the following error:

rake aborted!
无法找到JavaScript运行时。有关可用运行时的列表,请参见 https://github.com/sstephenson/execjs

rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.

我一直在搜索,建议的解决方案(见下面列表)是安装一些therubyracer或nodejs,但他们没有解释原因。

I've searched around and the suggested solutions (see list below) are to install some either therubyracer or nodejs but they don't explain why.

  • rake db:create - Could not find a JavaScript runtime
  • Rails 3.1 error - Could not find a JavaScript runtime?
  • http://datacodescotch.blogspot.com.au/2011/11/rails-31-spree-and-rake-aborted-could.html
  • http://www.blog.railshouse.com/

在我安装之前我会这样做蚂蚁知道这些JavaScript运行时之间的区别是什么以及为什么我会选择其中一个?

Before I go installing stuff I want to know what the differences are between these JavaScript runtimes and why I would choose one over the other?

更新:

我刚读过 https://github.com/sstephenson/execjs (我知道我应该已经读过这个了,对不起)在我看来execjs不是一个JavaScript运行时而且我已经拥有它...所以它归结为therubyracer和nodejs ...请原谅我的无知,我修改了我的问题

I just read https://github.com/sstephenson/execjs (I know I should have read this first, sorry) and it seems to me that execjs is not a JavaScript runtime and I already have it... so it's down to therubyracer and nodejs ... please excuse my ignorance, I've amended my question

除了Intrepidd的回答:

ruby​​ on rails入门指南支持Intrepidd的回答。请参阅 4.1启动Web服务器部分它所说的地方:

The ruby on rails getting started guide supports Intrepidd's answer. See section 4.1 "Starting up the Web Server" where it says:


Rails将geubfile中的therubyracer gem添加到注释行中,用于新的
应用程序,你可以取消注释需要它。

Rails adds the therubyracer gem to Gemfile in a commented line for new apps and you can uncomment if you need it.

对于那里的轨道noobs(像我一样),GemFile位于rails应用程序的根文件夹中。在我的GemFile中取消注释该行后,我必须运行 bundle install 来安装therubyracer gem。

For the rails noobs out there (like me) the GemFile is in the root folder of your rails application. After uncommenting that line in my GemFile I had to run bundle install to install therubyracer gem.

推荐答案

在* NIX系统上,你可以在gemfile中取消注释 gemtherubyracer,你很高兴,这是最简单的。

On a *NIX system, you can just uncomment the gem "therubyracer" in the gemfile and you're good to go, this is the easiest.

这篇关于therubyracer或nodejs,我应该使用哪个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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