node-serialport: A dynamic link library (DLL) initialization routine failed
SerialPort version:latest NodeJS Version:7.0.0 Operating System and Hardware Platform:win10 Are you using an alternative NodeJS runtime? (eg Electron):electron
Summary of Problem
When I run the electron, throw such as error!
Steps and Code to Reproduce the Issue
the code:
var SerialPort = require("serialport").SerialPort;
var portName = 'COM1';
var serialPort = new SerialPort(portName, {
baudRate: 9600,
dataBits: 8,
parityL:'none',
stopBits: 1,
flowControl: false
}, false);
serialPort.list(function (err, ports) {
ports.forEach(function(port) {
console.log(port.comName);
console.log(port.pnpId);
console.log(port.manufacturer);
});
});
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 16 (4 by maintainers)
@datamweb
export
that env_variables if you use linux. or useset
in windows.npm install serialport --save
or use this .bat file in windows,make sure you can build in nodejs before
@Caumaker @Quzal @datamweb
a easy way to do
if Windows , export use set, like
set npm_config_target=1.2.3
target is electron version
and then
npm install serialport --save
good luck