[英]First rails install: Rake aborted no javascript runtime
我正在觀看有關安裝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
嘗試安裝therubyracer gem
嘗試修復它:
/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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.