SemaphoreCI Fails With Node Version Due to ExecJS Dependency – BUG FIX

I came across this issue while upgrading an older version of a Ruby on Rails app. The error caused my continuous integration to fail.

ActionView::Template::Error (Autoprefixer doesn’t support Node v0.10.48. Update it.)

The way I solved it was to re-initialize the Node object in the application.js file.

module AppName
  ... # removed for brevity
end

## TODO: Check to see if ExecJS has fixed this bug. If so, delete the code below and check SemaphoreCI
module ExecJS
  module Runtimes
    Node = ExternalRuntime.new(
      name:        "Node.js (V8)",
      command:     ["node", "nodejs"],
      runner_path: ExecJS.root + "/support/node_runner.js",
      encoding:    'UTF-8'
    )
  end
end

This is a hackey way to solve this problem. With luck, ExecJS will update their gem in the future and this code can be removed. I’ve added a TODO here so I can remember to fix this down the line (note: if you run rails notes, you can see a list of TODOs in your app.)