Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 Rails服务器找不到JavaScript运行时_Ruby On Rails 4 - Fatal编程技术网

Ruby on rails 4 Rails服务器找不到JavaScript运行时

Ruby on rails 4 Rails服务器找不到JavaScript运行时,ruby-on-rails-4,Ruby On Rails 4,我得到以下错误。尝试搜索并尝试安装extjs、bundler等gems,但仍收到错误 harsha@harshamv:~/www/simple_cms$ rails s /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstep

我得到以下错误。尝试搜索并尝试安装extjs、bundler等gems,但仍收到错误

harsha@harshamv:~/www/simple_cms$ rails s
/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.3.1/lib/uglifier.rb:3:in `require'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.3.1/lib/uglifier.rb:3:in `<top (required)>'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/harsha/www/simple_cms/config/application.rb:7:in `<top (required)>'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:74:in `require'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:74:in `block in <top (required)>'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:71:in `tap'
    from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:71:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'
harsha@harshamv:~/www/simple\u cms$rails
/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:在“自动检测”中:找不到JavaScript运行时。看见https://github.com/sstephenson/execjs 获取可用运行时的列表。(ExecJS::RuntimeUnavailable)
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs.rb:5:in`'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs.rb:4:in`'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.3.1/lib/uglifier.rb:3:in'require'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.3.1/lib/uglifier.rb:3:in`'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in'require'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:在“请求中的块(2个级别)”中
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in'each'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in'block in require'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in'each'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in'require'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in'require'
from/home/harsha/www/simple\u cms/config/application.rb:7:in`'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:74:in'require'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:74:in'block in'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:71:in'tap'
from/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:71:in`'
从箱子/轨道:4:in“require”
从箱子/轨道:4:in`'

尝试安装最新的NodeJ


更多细节可以在这里找到

Ubuntu用户

 sudo yum install nodejs
我在Ubuntu 11.04上,也有类似的问题。安装Node.js修复了它

从Ubuntu 13.04 x64开始,您只需运行:

 sudo apt-get install nodejs
这将解决问题

CentOS/RedHat用户

 sudo yum install nodejs
替代溶液 只需在gem文件中添加ExecJS和Ruby Racer,然后运行bundle安装

   gem 'execjs'

  gem 'therubyracer'
可能重复的