simpljs
New Coder
Hi I have the following interaction, as you see the package ID is not found, immediately after being installed. This does not make any sense to me.
Why is there not more info in the error message?
the hello2.js code is:
Why is there not more info in the error message?
Code:
PS C:\opnsrc\ndEnv\smartPower> npm install -g tplink-smarthome-api
changed 11 packages, and audited 12 packages in 1s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
PS C:\opnsrc\ndEnv\smartPower> node hello2.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'tplink-smarthome-api'
Require stack:
- C:\opnsrc\ndEnv\smartPower\hello2.js
^[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)^[39m
^[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)^[39m
^[90m at Module.require (node:internal/modules/cjs/loader:1005:19)^[39m
^[90m at require (node:internal/modules/cjs/helpers:102:18)^[39m
at Object.<anonymous> (C:\opnsrc\ndEnv\smartPower\hello2.js:1:20)
^[90m at Module._compile (node:internal/modules/cjs/loader:1103:14)^[39m
^[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)^[39m
the hello2.js code is:
Code:
const { Client } = require('tplink-smarthome-api');
const client = new Client();
client.getDevice({ host: '10.0.0.60' }).then((device) => {
device.getSysInfo().then(console.log);
});