node-serialport

Error installing serialport on node.js

我只是一个虾纸丫 提交于 2019-12-11 13:13:32
问题 I am running windows 10 with node 4.2.2. I am trying to set up to work with my arduino but i keep running into issues installing serialport. Nothing I can find is helping. These are the errors I get when i run npm install serialport npm ERR! Windows_NT 10.0.10240 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "serialport" "-g" npm ERR! node v4.2.2 npm ERR! npm v2.14.7 npm ERR! code ELIFECYCLE npm ERR! serialport@2

node serialport stacking listeners and not getting complete response using a promise

不打扰是莪最后的温柔 提交于 2019-12-11 08:42:43
问题 I'm having an issue which is the promise based code I am trying to use is not every time getting back the complete response. I was using the data listener with .on, but changed it to .once because testing revealed I was stacking data listeners with each call. But either way I occasionally get partial responses. So how can I fix this. Not stack listeners, but get the complete response every time...and do it using a promise. sendPort: function(port, src) { return new Promise((resolve, reject) =

Exposing a TTY device in a docker container with docker for mac

倖福魔咒の 提交于 2019-12-11 08:42:06
问题 I'm trying to expose an Arduino that's plugged into my mac to a linux instance I'm running in Docker for Mac (no vm). The Arduino exposes itself as /dev/tty.usbserialXXX . I'm using the node docker image which is based upon ubuntu. The command I'm running is $ docker run --rm -it -v `pwd`:/app --device /dev/tty.usbmodem1421 node bash docker: Error response from daemon: linux runtime spec devices: error gathering device information while adding custom device "/dev/tty.usbmodem1421": lstat /dev

Error in electron-rebuild serialport on Windows

寵の児 提交于 2019-12-11 06:52:07
问题 I am developing a project with Electron and serialport. The serialport library doesn't work automatically. Searching in the Readme.md, I figure out that is needed to recompile the library for the NodeJS version of electron, using the electron-rebuild library. (Inserting this script in the package.json: "install": "electron-rebuild" ). The electron-rebuild require a python installed in the computer, so I have installed through windows-build-tools. (installed globally) So now when I run the

Node-serial port as external module in webpack - module not found

别说谁变了你拦得住时间么 提交于 2019-12-11 05:56:01
问题 I'm trying to get node-serialport to work with electron and webpack. I'm importing serialports as external module: # webpack.config.js externals: { serialport: "serialport" } This is the code in my app: // read NMEA data from serial port const SerialPort = require('serialport'); console.log(SerialPort.list()); const Readline = SerialPort.parsers.Readline; const port = new SerialPort('/dev/tty.Redmi-ShareGPS', { baudRate: 4800 }); const parser = port.pipe(new Readline({ delimiter: '\r\n' }));

SerialPort 'close' event never fire

心已入冬 提交于 2019-12-08 17:32:27
问题 I'm using nodeJS's SerialPort Package for connecting to computer ports. About Package's close event here. I have created this code, I would like to know why close / disconnect event never fire when I disconnect the COM const express = require('express'); const router = express.Router(); // const cors = require('cors'); router.use(cors()); // const SerialPort = require('serialport'); const Readline = SerialPort.parsers.Readline; const port = new SerialPort('COM7',function (err) { if (err) {

Sending bytes to serial port using Node.js

心已入冬 提交于 2019-12-08 09:11:58
问题 I am planning to do a POC with serialport communication using Node.js. I googled and found the "serialport" module for Node.js. I have a C# code which writes the data to the serial port in byte datatype. I would like to try the same using Node.js. The C# code has the following values in the byte[] array: 5, 170, 85, 250, 0, 86, 0, 3, 158, 0 Could anyone please tell me how to achieve this using Node.js's serialport module? 回答1: Finally I was able to figure it out. Just create a buffer variable

Node app fails to run because of prerelease

拜拜、爱过 提交于 2019-12-02 08:09:11
问题 I get invalid packages installing, even if the installation is a success. Btw, this question is related to the answer - question about versioning npm install serialport These are packages which is stuck far in the dependency tree. npm ERR! invalid: readable-stream@1.0.27-1 /Users/snorre edwin/Code/raspberry-node-server/node_modules/serialport/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream npm ERR! invalid: string_decoder@0.10.25-1 /Users/snorre edwin/Code

Serialport module in node.js works only if minicom is active on the port

假装没事ソ 提交于 2019-11-29 17:23:20
I am using version 3.10 of the serialport module of Node.js. I have a GSM modem attached to an Ubuntu machine's serialport and I am sending SMS through the modem. Here is the simplified code: var serialPort = require("serialport"); const Readline = serialPort.parsers.Readline; var portSerial = new serialPort("/dev/ttyUSB1", { baudrate: 115200, dataBits:8, stopBits:1, parity: 'none' }, function (err) { if (err) //log error here }); parser = new Readline(); portSerial.pipe(parser); portSerial.on("open", function(err) { if (err) return console.log("Error in opening serial port"); console.log(

Serialport module in node.js works only if minicom is active on the port

本小妞迷上赌 提交于 2019-11-28 12:34:08
问题 I am using version 3.10 of the serialport module of Node.js. I have a GSM modem attached to an Ubuntu machine's serialport and I am sending SMS through the modem. Here is the simplified code: var serialPort = require("serialport"); const Readline = serialPort.parsers.Readline; var portSerial = new serialPort("/dev/ttyUSB1", { baudrate: 115200, dataBits:8, stopBits:1, parity: 'none' }, function (err) { if (err) //log error here }); parser = new Readline(); portSerial.pipe(parser); portSerial