Error with terminal on JavaScript

Hello! Im using microcontroller on JavaScript, and i have a problem with connecting terminal widget.
Its my terminal in espruino web ide:

        ____       __
       /  _/_____ / /__ _____ ____ _
       / / / ___// //_// ___// __ `/
     _/ / (__  )/ ,<  / /   / /_/ /
    /___//____//_/|_|/_/    \__,_/
    Based on Espruino 1v85.1113
    (c) 2016 G.Williams, Amperka LLC
    Support the work of core developers:
    Erasing Flash....
    Writing................
    Compressed 87200 bytes to 13546
    Checking...
    Done!
    Loading 13546 bytes from flash...
    Connecting to TCP: blynk-cloud.com 8442
    Uncaught ReferenceError: "needsEmitter" is not defined
     at line 1 col 1
    needsEmitter()&&events.EventEmitter.call(this),this.pin=b,a....
    ^
    in function "WidgetTerminal" called from line 34 col 38
    var term = new blynk.WidgetTerminal(3);
                                         ^
     
    =undefined
    Connected
    Disconnect blynk
    Connecting to TCP: blynk-cloud.com 8442
    Connected
    Connected
    Authorized
 

Here’s my code:

 var BlynkLib = require('https://github.com/vshymanskyy/blynk-library-js/blob/master/blynk-espruino.js');
 
 var blynk = new BlynkLib.Blynk('fb9386c0a3fd451d9740b53c707d7d52');
 var v1 = new blynk.VirtualPin(1);
 var v9 = new blynk.VirtualPin(9);
 
 v1.on('write', function(param) {
   console.log('V1:', param[0]);
 });
 
 v9.on('read', function() {
   v9.write(new Date().getSeconds());
 });
 
 var term = new blynk.WidgetTerminal(3);
 term.on('write', function(data) {
   term.write('You wrote:' + data + '\n');
   blynk.notify("HAHA! " + data);
 });

How can i fix this problem?

I don’t know how to solve your issue, but I’d fix that post formatting before @Gunner sees this… :wink:

2 Likes

Hi Everyone, I have the same issue with WidgetTerminal

WiFi connection is Ok
Slider and Graphs are working fine.

But when you add:
var term = new blynk.WidgetTerminal(3);

The error code is


Uncaught ReferenceError: “needsEmitter” is not defined


Can you advice what the problem could be?

What code are YOU using? Most likely same code = same error.

I took the original OPs code, and adjusted for my installed NodeJS library location, and it works just fine.

const Blynk = require('/usr/lib/node_modules/blynk-library');  // Links variable 'Blynk' to the installed Blynk Library

I recommend you install the latest version of the NodeJS library and start working through the examples… then create your own current topic for any issue you run into, not tack onto a two year old one.