Ruby on rails 获取“中的错误”;rails s";,服务器未运行

Ruby on rails 获取“中的错误”;rails s";,服务器未运行,ruby-on-rails,ruby,ruby-on-rails-3.1,Ruby On Rails,Ruby,Ruby On Rails 3.1,它是Rails 3.1.0 我所做的: rails new site cd site rails s 我得到的信息是: /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list

它是Rails 3.1.0

我所做的:

rails new site
cd site
rails s
我得到的信息是:

/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.2.9/lib/execjs.rb:5:in `<module:ExecJS>'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.2.9/lib/execjs.rb:4:in `<top (required)>'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in `require'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in `<top (required)>'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
    from /home/user1/social/config/application.rb:7:in `<top (required)>'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0/lib/rails/commands.rb:52:in `require'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0/lib/rails/commands.rb:52:in `block in <top (required)>'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
    from /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0/lib/rails/commands.rb:49:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:在“自动检测”中:找不到JavaScript运行时。看见https://github.com/sstephenson/execjs 获取可用运行时的列表。(ExecJS::RuntimeUnavailable)
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.2.9/lib/execjs.rb:5:in`'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/execjs-1.2.9/lib/execjs.rb:4:in`'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-script-2.2.0/lib/coffee_-script.rb:1:in'require'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-script-2.2.0/lib/coffee\u script.rb:1:in`'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in'require'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in`'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in'require'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in`'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in'require'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:在“请求中的块(2个级别)”中
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:在'each'中
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:在“请求中的块”中
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:在'each'中
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in'require'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.21/lib/bundler.rb:122:in'require'
from/home/user1/social/config/application.rb:7:in`'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0/lib/rails/commands.rb:52:in'require'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0/lib/rails/commands.rb:52:in'block in'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0/lib/rails/commands.rb:49:in'tap'
from/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0/lib/rails/commands.rb:49:in`'
来自脚本/rails:6:in'require'
来自脚本/rails:6:in`'
为什么我会犯这个错误


有人可以提示修复它吗?

正如错误所述,您没有安装Javascript运行时。你应该自己选一个

将此添加到您的文件:

gem "therubyracer"

然后运行
bundle install
并重试。

您可能还需要安装node.js(对我有帮助)


为我工作…

只需打开应用程序文件夹根目录中的文件“Gemfile”,然后将下面的行粘贴到那里

gem 'execjs'

gem 'libv8'

gem 'therubyracer'
粘贴后,只需保存文件并在命令提示符下执行“bundle update”

成功完成捆绑包更新后,请尝试运行“rails s”。它起作用了


谢谢。

看到您的问题,您的系统会抱怨
缺少JavaScript运行时。

你应该去看看一份可能性清单

我建议您从这里下载node.js

这样做:

cd *your download dir*
tar xvf node-v0.4.11.tar.gz
cd node-v0.4.11
./configure
make
sudo make install
我给出这个答案是因为这对我很有效


这个答案对你很有帮助。

dup:我该如何安装node.js?也就是说,你也可以问谷歌
cd *your download dir*
tar xvf node-v0.4.11.tar.gz
cd node-v0.4.11
./configure
make
sudo make install