Versions:
F:\Code\twitch-train-control>npm --version
8.19.3
F:\Code\twitch-train-control>node --version
v18.13.0
Windows 11 Pro, 22621.1194
Installation:
F:\Code\twitch-train-control>npm install node-poweredup --save
added 9 packages, and audited 10 packages in 11s
found 0 vulnerabilities
Attempting to run a very basic script:
const PoweredUP = require("node-poweredup");
const poweredUP = new PoweredUP.PoweredUP();
poweredUP.on("discover", async (hub) => { // Wait to discover a Hub
console.log(`Discovered ${hub.name}!`);
await hub.connect();
const motorA = await hub.waitForDeviceAtPort("A");
console.log("Connected");
console.log(motorA);
console.log(hub);
});
Results in this error:
F:\Code\twitch-train-control>node traincontrol.js
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module '@abandonware/bluetooth-hci-socket'
Require stack:
- F:\Code\twitch-train-control\node_modules\@abandonware\noble\lib\hci-socket\hci.js
- F:\Code\twitch-train-control\node_modules\@abandonware\noble\lib\hci-socket\bindings.js
- F:\Code\twitch-train-control\node_modules\@abandonware\noble\lib\resolve-bindings.js
- F:\Code\twitch-train-control\node_modules\@abandonware\noble\index.js
- F:\Code\twitch-train-control\node_modules\node-poweredup\dist\node\poweredup-node.js
- F:\Code\twitch-train-control\node_modules\node-poweredup\dist\node\index-node.js
- F:\Code\twitch-train-control\traincontrol.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (F:\Code\twitch-train-control\node_modules\@abandonware\noble\lib\hci-socket\hci.js:6:28)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'F:\\Code\\twitch-train-control\\node_modules\\@abandonware\\noble\\lib\\hci-socket\\hci.js',
'F:\\Code\\twitch-train-control\\node_modules\\@abandonware\\noble\\lib\\hci-socket\\bindings.js',
'F:\\Code\\twitch-train-control\\node_modules\\@abandonware\\noble\\lib\\resolve-bindings.js',
'F:\\Code\\twitch-train-control\\node_modules\\@abandonware\\noble\\index.js',
'F:\\Code\\twitch-train-control\\node_modules\\node-poweredup\\dist\\node\\poweredup-node.js',
'F:\\Code\\twitch-train-control\\node_modules\\node-poweredup\\dist\\node\\index-node.js',
'F:\\Code\\twitch-train-control\\traincontrol.js'
]
}
Node.js v18.13.0
Alright, so what if I require that package explicitly:
F:\Code\twitch-train-control>npm install bluetooth-hci-socket
added 4 packages, and audited 14 packages in 5s
found 0 vulnerabilities
Running the code again gives me the exact same error as above, though, so no changes if I try this.
package.json after this:
{
"dependencies": {
"bluetooth-hci-socket": "^0.5.1",
"node-poweredup": "^8.0.5"
}
}
I can provide the lockfile if required.
I feel like I'm missing something but I do not have enough experience with JS packages to work that out. I'm happy to run debugging commands if you let me know what other output would be useful.
Versions:
Installation:
Attempting to run a very basic script:
Results in this error:
Alright, so what if I require that package explicitly:
Running the code again gives me the exact same error as above, though, so no changes if I try this.
package.json after this:
I can provide the lockfile if required.
I feel like I'm missing something but I do not have enough experience with JS packages to work that out. I'm happy to run debugging commands if you let me know what other output would be useful.