我正在观看有关安装Rails的视频教程,并且在安装Rails,Gem和mysql之后,该视频通过rake db:create作为测试,以确保mysql正常工作。

c:\row\dev\Hello_World>rake db:create
DL is deprecated, please use Fiddle
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'uglifier'.
c:/row/dev/Hello_World/config/application.rb:7:in `<top (required)>'
c:/row/dev/Hello_World/Rakefile:4:in `<top (required)>'
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
c:/row/dev/Hello_World/config/application.rb:7:in `<top (required)>'
c:/row/dev/Hello_World/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)


我有点迷路了。任何帮助,将不胜感激。

由于它在评论中出现了两次,因此gem install therubyracer给出了以下信息:

ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.

    c:/row/Ruby21/bin/ruby.exe extconf.rb
creating Makefile
which: no python in (.;c:\row\Ruby21\devkit\bin;c:\row\Ruby21\devkit\mingw\bin;c:\windows;C:\Program Files\MySQL\MySQL Server 5.7\bin;c:\row\Ruby21\bin)
The system cannot find the path specified.
which: no python in (.;c:\row\Ruby21\devkit\bin;c:\row\Ruby21\devkit\mingw\bin;c:\windows;C:\Program Files\MySQL\MySQL Server 5.7\bin;c:\row\Ruby21\bin)
c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.13/ext/libv8/builder.rb:81:in `setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently not available (RuntimeError)
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.13/ext/libv8/builder.rb:55:in `block in build_libv8!'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.13/ext/libv8/builder.rb:52:in `chdir'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.13/ext/libv8/builder.rb:52:in `build_libv8!'
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:24:in `install!'
        from extconf.rb:7:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.13 for inspection.
Results logged to c:/row/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/libv8-3.16.14.13/gem_make.out

最佳答案

尝试修复它:

/usr/local/lib/ruby/gems/ruby_ver/gems/execjs-ver/lib/execjs/runtimes.rb

Node = ExternalRuntime.new(
      :name        => "Node.js (V8)",
      :command     => ["nodejs", "/usr/local/bin/node"],
      :runner_path => ExecJS.root + "/support/node_runner.js",
      :encoding    => 'UTF-8'
    )

10-06 04:18