1

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

4 Answers 4

1

Try to install therubyracer gem

Sign up to request clarification or add additional context in comments.

7 Comments

gem install therubyracer gave me and error that it couldn't find the path specified and it could not find python.
add gem 'therubyracer', :platforms => :ruby in your Gemfile and run bundle install
Ok, added that to the gemfile, saved, then ran bundle install. therubyracer does not show up on the list of gems used and it doesn't say it was installed.
I didn't pay attention that you use Windows. This answer may be useful stackoverflow.com/a/6359265/1998300
Looks like I don't need therubyracer gem, but its still not clear why I have an error loading uglifier on the rake db:create command.
|
0

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

5 Comments

Can you elaborate? I found the execjs runtimes.rb file but its not clear to me what I need to do with it.
@Mike, open it in a text editor and bring the file to a form.
Neither made any noticeable change.
Ok, some progress now. The runtime error is gone but the uglifier issue is still there. Thanks for sticking with me so far.
0

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

In my AmazonWS AMI EC2 this fix it.

3 Comments

Node.js is installed on my system.
Such as You use Windows, may be it don't see node.js path and, possible, restart system required...
...We talk about node.js but not about gem node. May be it is conflict node.js and node gem... You could see nodejs.org for clear install of node.js
0

Paste it into terminal

gem install therubyracer

INSERT INTO YOUR Gemfile

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

run

bundle install

2 Comments

I am getting an error when I attempt to install therubyracer. I updated the question to include the error text.
@Mike try to install nodejs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.