Working with NodeJs serialPort - Error: %1 is not a valid Win32 application
Working with NodeJs serialPort - Error: %1 is not a valid Win32 application
我正在尝试让串行端口 (https://www.npmjs.com/package/serialport) 在 windows 上工作,以便我可以将命令发送到我的串行端口并因此 open/close 锁定。
串口是通过bash安装的。
npm install serialport --save-dev
错误如下
C:\Users\[...]\electron-with-express\express-app\node_modules\bindings\bindings.js:83
Error: %1 is not a valid Win32 application.
下面是页面
var express = require('express');
var router = express.Router();
var SerialPort = require('serialport');
// check which port is available
//var sp = require('../');
/* GET home page */
router.get('/', function(request, response){
//sp.list(function(err, ports) {
// console.log(ports);
//});
SerialPort.list(function (err, ports) {
ports.forEach(function(port) {
console.log(port.comName);
console.log(port.pnpId);
console.log(port.manufacturer);
});
});
});
// Important
module.exports = router;
NodeJs 应用程序正在 运行 通过 Electron
必须重建 serialport
等本机节点模块以针对您正在使用的特定 Electron 版本,为此请按照 http://electron.atom.io/docs/tutorial/using-native-node-modules/
中记录的步骤进行操作
还有一个open issue covering the topic, so if you get stuck at least read this comment。
我正在尝试让串行端口 (https://www.npmjs.com/package/serialport) 在 windows 上工作,以便我可以将命令发送到我的串行端口并因此 open/close 锁定。
串口是通过bash安装的。
npm install serialport --save-dev
错误如下
C:\Users\[...]\electron-with-express\express-app\node_modules\bindings\bindings.js:83
Error: %1 is not a valid Win32 application.
下面是页面
var express = require('express');
var router = express.Router();
var SerialPort = require('serialport');
// check which port is available
//var sp = require('../');
/* GET home page */
router.get('/', function(request, response){
//sp.list(function(err, ports) {
// console.log(ports);
//});
SerialPort.list(function (err, ports) {
ports.forEach(function(port) {
console.log(port.comName);
console.log(port.pnpId);
console.log(port.manufacturer);
});
});
});
// Important
module.exports = router;
NodeJs 应用程序正在 运行 通过 Electron
必须重建 serialport
等本机节点模块以针对您正在使用的特定 Electron 版本,为此请按照 http://electron.atom.io/docs/tutorial/using-native-node-modules/
还有一个open issue covering the topic, so if you get stuck at least read this comment。