综合技术

ExecJS :: RuntimeError in ChatRooms # show

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')
        textarea.val('')
      e.preventDefault()
      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!

Facebook also wants to show you how much time you spend in its app

上一篇

Issue 357

下一篇

你也可能喜欢

评论已经被关闭。

插入图片
ExecJS &colon;&colon; RuntimeError in ChatRooms &num; show

长按储存图像,分享给朋友