Open SunboX opened 1 year ago
Running it on macOS:
$ node app.mjs
darwin
(node:12343) UnhandledPromiseRejectionWarning: Error: ERROR : use init before
at Module.exports.scan (/xxx/node_modules/node-wifi/src/wifi.js:77:9)
at Function.start (file:///xxx/app.mjs:14:14)
at file:///xxx/app.mjs:24:5
at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12343) 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:12343) [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.
When using type: "module", importing a CommonJS such as node-wifi requires special attention. node-wifi does not natively support ESM, so you must use the createRequire method of Node.js.
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const wifi = require('node-wifi');
Expected behavior
getting a wifi networks list
Current behavior
Error thrown: ERROR : use init before
Which are the affected features
Which is your operating system?
Linux
Environment
OpenEmbedded / Yocto / Linux kernel 5.4.88 running on i.MX6X with ath6k and bcm43236b drivers
Version of node-wifi
2.0.16
Steps to Reproduce
app.mjs
Solutions
maybe related to