emonCMS - DigitalOcean - Message: Uncaught ReferenceError: _lang is not defined

Hi,

I’ve just installed a remote install of EmonCMS on a DigitalOcean Droplet after seeing the instructions - EmonScripts/readme.md at master · openenergymonitor/EmonScripts · GitHub

All appeared to go well and it is up and running, with the exception of an error when trying to create dashboards -

EmonCMS Error

Message: Uncaught ReferenceError: _lang is not defined
Route: Modules/graph/graph.js?v=1
Line: 635
Column:21

Would anyone have any thoughts as to what may be causing this?

I have included the server info below -

Server Information

Server Information

Services

  • emonhub :- Active Running
  • emoncms_mqtt :- Active Running
  • feedwriter :- Active Running - sleep 300s 91 feed points pending write
  • service-runner :- Active Running
  • emonPiLCD :- Activating Auto-restart
  • redis-server :- Active Running
  • mosquitto :- Active Running
  • demandshaper :- Activating Auto-restart

Emoncms

Server

  • OS :- Linux 4.15.0-66-generic
  • Host :- ubuntu-s-1vcpu-1gb-lon1-01 | ubuntu-s-1vcpu-1gb-lon1-01 | (167.172.62.46)
  • Date :- 2019-12-30 22:19:55 UTC
  • Uptime :- 22:19:55 up 2:31, 2 users, load average: 0.00, 0.02, 0.00

Memory

  • RAM :- Used: 33.75%
    • Total :- 985.52 MB
    • Used :- 332.63 MB
    • Free :- 652.89 MB
      Write Load Period

Disk

  • / :- Used: 8.60%
    • Total :- 24.06 GB
    • Used :- 2.07 GB
    • Free :- 21.97 GB
    • Write Load :- n/a
  • /boot/efi :- Used: 3.43%
    • Total :- 104.35 MB
    • Used :- 3.58 MB
    • Free :- 100.77 MB
    • Write Load :- n/a

HTTP

  • Server :- Apache/2.4.29 (Ubuntu) HTTP/1.1 CGI/1.1 80

MySQL

  • Version :- 5.5.5-10.1.43-MariaDB-0ubuntu0.18.04.1
  • Host :- localhost:6379 (127.0.0.1)
  • Date :- 2019-12-30 22:19:55 (UTC 00:00‌​)
  • Stats :- Uptime: 8149 Threads: 3 Questions: 12725 Slow queries: 0 Opens: 177 Flush tables: 1 Open tables: 40 Queries per second avg: 1.561

Redis

  • Version :-
    • Redis Server :- 4.0.9
    • PHP Redis :- 5.1.1
  • Host :- localhost:6379
  • Size :- 73 keys (897.61K)
  • Uptime :- 0 days

MQTT Server

  • Version :- Mosquitto 1.4.15
  • Host :- localhost:1883 (127.0.0.1)

PHP

  • Version :- 7.2.24-0ubuntu0.18.04.1 (Zend Version 3.2.0)
  • Modules :- apache2handler | calendar v7.2.24-0ubuntu0.18.04.1 | Core v7.2.24-0ubuntu0.18.04.1 | ctype v7.2.24-0ubuntu0.18.04.1 | curl v7.2.24-0ubuntu0.18.04.1 | date v7.2.24-0ubuntu0.18.04.1 | dom v20031129 | exif v7.2.24-0ubuntu0.18.04.1 | fileinfo v1.0.5 | filter v7.2.24-0ubuntu0.18.04.1 | ftp v7.2.24-0ubuntu0.18.04.1 | gd v7.2.24-0ubuntu0.18.04.1 | gettext v7.2.24-0ubuntu0.18.04.1 | hash v1.0 | iconv v7.2.24-0ubuntu0.18.04.1 | json v1.6.0 | libxml v7.2.24-0ubuntu0.18.04.1 | mbstring v7.2.24-0ubuntu0.18.04.1 | mosquitto v0.4.0 | mysqli v7.2.24-0ubuntu0.18.04.1 | mysqlnd vmysqlnd 5.0.12-dev - 20150407 - $Id: 3591daad22de08524295e1bd073aceeff11e6579 $ | openssl v7.2.24-0ubuntu0.18.04.1 | pcre v7.2.24-0ubuntu0.18.04.1 | PDO v7.2.24-0ubuntu0.18.04.1 | pdo_mysql v7.2.24-0ubuntu0.18.04.1 | Phar v2.0.2 | posix v7.2.24-0ubuntu0.18.04.1 | readline v7.2.24-0ubuntu0.18.04.1 | redis v5.1.1 | Reflection v7.2.24-0ubuntu0.18.04.1 | session v7.2.24-0ubuntu0.18.04.1 | shmop v7.2.24-0ubuntu0.18.04.1 | SimpleXML v7.2.24-0ubuntu0.18.04.1 | sockets v7.2.24-0ubuntu0.18.04.1 | sodium v7.2.24-0ubuntu0.18.04.1 | SPL v7.2.24-0ubuntu0.18.04.1 | standard v7.2.24-0ubuntu0.18.04.1 | sysvmsg v7.2.24-0ubuntu0.18.04.1 | sysvsem v7.2.24-0ubuntu0.18.04.1 | sysvshm v7.2.24-0ubuntu0.18.04.1 | tokenizer v7.2.24-0ubuntu0.18.04.1 | wddx v7.2.24-0ubuntu0.18.04.1 | xml v7.2.24-0ubuntu0.18.04.1 | xmlreader v7.2.24-0ubuntu0.18.04.1 | xmlwriter v7.2.24-0ubuntu0.18.04.1 | xsl v7.2.24-0ubuntu0.18.04.1 | Zend OPcache v7.2.24-0ubuntu0.18.04.1 | zlib v7.2.24-0ubuntu0.18.04.1
Client Information

Client Information

HTTP

  • Browser :- Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
  • Language :- en-US,en;q=0.9,en-GB;q=0.8

Window

  • Size :- 1903 x 888

Screen

  • Resolution :- 1920 x 1080

This will need to wait until @TrystanLea resurfaces as he did that install.

1 Like

I’ve uploaded a fix for this to the graph module, change info here: fix missing language array in embed mode · emoncms/[email protected] · GitHub

If you run the updater to pull in the latest it should now work

1 Like

If you are using any script file and getting "Uncaught ReferenceError: x is not defined " which means ‘x’ is either a variable or a method which you are trying to use before declaring it using var keyword. This means that there is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope otherwise , it will endup throwing this ‘x’ is not defined error . This usually indicates that your library is not loaded and JavaScript does not recognize the ‘x’.

To solve this error: Load your library at the beginning of all your scripts.

There can be multiple other reasons for this issue:

  • Conflict with Other Libraries
  • Path to your library included is not correct
  • Llibrary file is corrupted
  • Working offline (when you use CDN)