Mike
Mike

Reputation: 43

First rails install: Rake aborted no javascript runtime

I am following a video tutorial for installing rails and after installing rails, gems, and mysql, the video walks through rake db:create as a test to ensure mysql is working correctly.

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)

I'm a bit lost. Any help would be appreciated.

since it came up a couple of times in the comments, gem install therubyracer gave this:

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

Upvotes: 1

Views: 647

Answers (4)

vipin
vipin

Reputation: 2510

Paste it into terminal

gem install therubyracer

INSERT INTO YOUR Gemfile

  gem 'uglifier', '~> 2.7', '>= 2.7.2'

run

bundle install

Upvotes: 0

As case, You could install node.js into system.

In my AmazonWS AMI EC2 this fix it.

Upvotes: 0

Artur Olenberg
Artur Olenberg

Reputation: 510

Try fix it:

/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'
    )

Upvotes: 0

Alexandr T
Alexandr T

Reputation: 1501

Try to install therubyracer gem

Upvotes: 1

Related Questions