Я хочу получить данные от SerialPort COM от Arduino. Я использую Windows 10. Я разрабатываю приложение на Nodejs, оно отлично работает в моей локальной сети, но когда я развернул свое Nodejs приложение в Heroku, я не могу ничего получить, я получил это сообщение журнала от heroku * консоль
2020-02-25T19:06:15.325036+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: Error: Error: No such file or directory, cannot open COM8
2020-02-25T19:06:15.325136+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2020-02-25T19:06:15.325252+00:00 app[web.1]: (node:23) [DEP0018] 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.
код на сервере:
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, datosconsulta = require('./routes/consultas')
, http = require('http')
, path = require('path');
//var methodOverride = require('method-override');
var session = require('express-session');
var app = express();
var mysql = require('mysql');
var bodyParser=require("body-parser");
var flash = require('connect-flash')
var serialPort = require("serialport");
const PORT = process.env.PORT || 3000;
var server = app.listen(PORT, () => { //Start the server, listening on port 4000.
console.log("Aplicacion corriendo a través del puerto "+PORT);
})
var io = require('socket.io')(server);
var serialPort = require("serialport");
serial = new serialPort(COM8,{parser: new serialPort.parsers.Readline("\r\n"),"baudRate": 9600});
serial.on('open',function(err){
if(err != null)
{
console.log("error no se puedo conectar el puerto COM");
}
else
{
console.log("Conexion USB lista");
serial.on('data', function (data) {
var readData += data.toString();
console.log("dato serial" + readData);
}
});
}
});