Я пытался установить модуль узла udev, но получил ошибку при установке.
npm установить udev
Переход по этой ссылке udev
Ошибка:
npm WARN enoent ENOENT: no such file or directory, open '/home/mitesh/package.json'
npm WARN mitesh No description
npm WARN mitesh No repository field.
npm WARN mitesh No README data
npm WARN mitesh No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! udev@0.6.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the udev@0.6.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mitesh/.npm/_logs/2020-03-16T11_44_35_032Z-debug.log
Также попытался использовать модуль serialport, чтобы получить список последовательных устройств, подключенных к p c. Код (список. js):
var serialport = require('serialport');
// list serial ports:
serialport.list(function (err, ports) {
ports.forEach(function(port) {
console.log(port.comName.toString());
});
});
Ошибка:
(node:10205) UnhandledPromiseRejectionWarning: TypeError: SerialPort.list no longer takes a callback and only returns a promise
at Function.SerialPort.list (/home/mitesh/node_modules/@serialport/stream/lib/index.js:651:11)
at Object.<anonymous> (/home/mitesh/Desktop/ESP/ILT_Projects/Read files JS/list.js:4:12)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
(node:10205) 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)
(node:10205) [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.