ExecJS :: RuntimeError in ChatRooms # show

综合技术 2018-06-23 阅读原文

The issue I'm having:

This is my room.coffee file, and everything works well.

jQuery(document).on 'turbolinks:load', ->
  messages = $('#messages')
  if $('#messages').length > 0

    App.global_chat = App.cable.subscriptions.create {
        channel: "ChatRoomsChannel"
        chat_room_id: messages.data('chat-room-id')
      connected: ->
        # Called when the subscription is ready for use on the server

      disconnected: ->
        # Called when the subscription has been terminated by the server

      received: (data) ->
        # Data received

      send_message: (message, chat_room_id) ->
        @perform 'send_message', message: message, chat_room_id: chat_room_id
@import "bootstrap-sprockets";
@import "bootstrap";

#messages {
  max-height: 450px;
  overflow-y: auto;
  .avatar {
    margin: 0.5rem;

<div id="messages" data-chat-room-id="">

From 2 to 1000 characters

But it shows ExecJS::RuntimeError after I added the code down below in the same file.

$('#new_message').submit (e) ->
      $this = $(this)
      textarea = $this.find('#message_body')
      if $.trim(textarea.val()).length > 1
        App.global_chat.send_message textarea.val(), messages.data('chat-room-id')
      return false

I did search similar problems a lot, and most people who use pc encountered this issue. But I'm using mac, I have no idea why I got this error as well.

You need javascript runtime environment

Install node.js or add therubyracer gem

sudo apt-get install nodejs

ORAdd therubyracer gem in your Gemfile

gem 'therubyracer'
Hello, buddy!

责编内容by:Hello, buddy!阅读原文】。感谢您的支持!


sending objects to a callback function as a pramet... i am implementing a http server for some project. i have an HttpServer object that i created that co...
Heroku can’t find local module on heroku (No... I'm working on a Node.js app, and am using a config.js file that exposes my twitter API tokens/secrets. I'm d...
Convert A Node.js RESTful API To Serverless With O... When it comes to serverless solutions, there are many options available. If you’re a fan of the Microsoft cloud, you co...
nodejs+express+mysql实现restful风格的增删改查示例... 首先,放上项目github地址: https://github.com/codethereforam/express-mysql-demo 一、前言 之前学的java,一直用的ssm框架写后台。前段时间接触到node...
Noder – Simple Docker NodeJS Sandbox Noder Docker NodeJS sandbox for testing code with an editor. Quick Start Run the docker container with interact...