【问题标题】:Could not find a JavaScript runtime error找不到 JavaScript 运行时错误
【发布时间】:2015-12-03 07:31:31
【问题描述】:

我在 rails4 中设置了一个项目,当我尝试启动服务器时它没有给出这个错误。一切似乎都很好,但我不知道出了什么问题。这是错误:

neha@ubuntu:~/Desktop/myapp$ rails s -p 3001
/home/neha/.rvm/gems/ruby-2.2.0/gems/execjs-2.6.0/lib/execjs/runtimes.rb:48:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home/neha/.rvm/gems/ruby-2.2.0/gems/execjs-2.6.0/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/execjs-2.6.0/lib/execjs.rb:4:in `<top (required)>'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/uglifier-2.7.2/lib/uglifier.rb:3:in `require'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/uglifier-2.7.2/lib/uglifier.rb:3:in `<top (required)>'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from /home/neha/Desktop/myapp/config/application.rb:7:in `<top (required)>'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/neha/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

I am using Rails 4 on ubuntu 14.04

【问题讨论】:

    标签: javascript ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4


    【解决方案1】:

    运行此命令安装node.js,错误将得到修复。

    sudo add-apt-repository ppa:chris-lea/node.js 
    sudo apt-get -y update 
    sudo apt-get -y install nodejs
    

    【讨论】:

    • 如果这对您有用,您可以接受答案。
    猜你喜欢
    • 2016-11-22
    • 2015-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-15
    • 2011-10-28
    • 2014-12-10
    • 1970-01-01
    相关资源
    最近更新 更多