Azure / azure-iot-sdk-node

A Node.js SDK for connecting devices to Microsoft Azure IoT services
https://docs.microsoft.com/en-us/azure/iot-hub/
Other
261 stars 227 forks source link

Error: Cannot find module 'azure-iot-device-mqtt' #1217

Closed pbrane closed 7 months ago

pbrane commented 8 months ago
- **OS and version used:** MacOS, Sonoma 14.3.1, Intel Processor
- **Node.js version:** 21.6.2
- **npm version:** 10.2.4
- **list of installed packages:** $ npm list
azure-iot-sdk-node@ /Users/david/development/src/molex/azure-iot-sdk-node
├── eslint-plugin-security@1.7.1
├── lerna@5.6.2
├── mocha@9.2.2
├── node-gyp@9.4.1
└── typescript@4.4.4
- **cloned repo:** 2020-08-18-228-ga85e2803

Description of the issue

I pulled the latest code while working through the Quickstart: Provision a simulated symmetric key device found here: https://learn.microsoft.com/en-us/azure/iot-dps/quick-create-simulated-device-symm-key?pivots=programming-language-nodejs

When I execute the command as described, get an error indicating it can't find a module:

$ node provisioning/device/samples/register_symkey.js
node:internal/modules/cjs/loader:1152
  throw err;
  ^

Error: Cannot find module 'azure-iot-device-mqtt'
Require stack:
- /Users/david/development/src/molex/azure-iot-sdk-node/provisioning/device/samples/register_symkey.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1149:15)
    at Module._load (node:internal/modules/cjs/loader:990:27)
    at Module.require (node:internal/modules/cjs/loader:1237:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/david/development/src/molex/azure-iot-sdk-node/provisioning/device/samples/register_symkey.js:6:23)
    at Module._compile (node:internal/modules/cjs/loader:1378:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
    at Module.load (node:internal/modules/cjs/loader:1212:32)
    at Module._load (node:internal/modules/cjs/loader:1028:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/david/development/src/molex/azure-iot-sdk-node/provisioning/device/samples/register_symkey.js'
  ]
}
vishnureddy17 commented 8 months ago

Can you try running npm install from the /provisioning/device/samples/ directory?

pbrane commented 8 months ago

Can you try running npm install from the /provisioning/device/samples/ directory?

Thanks, but that generated 486 errors. Seems something isn't right with my build env. I'll keep digging.

vishnureddy17 commented 7 months ago

Closing due to inactivity. Feel free to re-open if needed.