The error message tells you what the problem is:
ExecJS::ProgramError: ReferenceError: window is not defined
jQuery is a library for DOM manipulation. It expects to see all of the usual DOM objects and interfaces, including the window
object.
The ExecJS library you're using doesn't provide a DOM or a window
object. It provides a JavaScript execution context, but not the same one a browser provides.
You may possibly be able to get this working by using another library such as JSDOM to provide a DOM that jQuery can use. Here is a search that may give some tips.
The first link describes a use of JSDOM and jQuery with ExecJS that may be similar to what you want.
That said, why jQuery? There are several good Ruby HTML parsers including Nokogiri. Why not try one of those?