openbci-archive/OpenBCI_NodeJS_Ganglion

Node Deprecation Warnings

Opened this issue · 8 comments

Currently getting the following deprecation warnings when I run the example:

const Ganglion = require('openbci-ganglion').Ganglion;
const ganglion = new Ganglion();
ganglion.once('ganglionFound', (peripheral) => {
  // Stop searching for BLE devices once a ganglion is found.
  ganglion.searchStop();
  ganglion.on('sample', (sample) => {
    /** Work with sample */
    console.log(sample.sampleNumber);
    for (let i = 0; i < ganglion.numberOfChannels(); i++) {
      console.log("Channel " + (i + 1) + ": " + sample.channelData[i].toFixed(8) + " Volts.");
    }
  });
  ganglion.once('ready', () => {
    ganglion.streamStart();
  });
  ganglion.connect(peripheral);
});
// Start scanning for BLE devices
ganglion.searchStart();
(node:96316) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Please turn blue tooth on.
(node:96316) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Turn Bluetooth on?

Bluetooth is on. I'm running Node 7.8.
Could be that.

oh i think you need to do <=6

It works though...
But why do I need Node 6?

noble if i remember

i tried to do the node engines in the package.json to prevent this, how can we fix this? should we leave this open? any ideas

I think we should leave open. This is just a warning, everything seems to be working.
We could look to see if in your code there is a promise without a .catch().

ohhh yeah ok haha good