首先 rails 安装:Rake 中止没有 javascript 运行时
First rails install: Rake aborted no javascript runtime
我正在观看安装 rails 的视频教程,在安装 rails、gems 和 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
尝试安装therubyracergem
尝试修复它:
/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'
)
根据情况,您可以将 node.js 安装到系统中。
在我的 AmazonWS AMI EC2 中修复它。
将其粘贴到终端
gem install therubyracer
插入您的 Gemfile
gem 'uglifier', '~> 2.7', '>= 2.7.2'
运行
bundle install
我正在观看安装 rails 的视频教程,在安装 rails、gems 和 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
尝试安装therubyracergem
尝试修复它:
/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'
)
根据情况,您可以将 node.js 安装到系统中。
在我的 AmazonWS AMI EC2 中修复它。
将其粘贴到终端
gem install therubyracer
插入您的 Gemfile
gem 'uglifier', '~> 2.7', '>= 2.7.2'
运行
bundle install