Error with zigbee2mqtt in LXD container: Cannot find module 'aws-sdk'

I encounter the following issue when following these instructions to configure zigbee2mqtt in a lxd container.

I did apt update & upgrade, but it does not help. Note that in lxd containers, there is only root.

root@OpenHAB:/opt/zigbee2mqtt# node --version
v10.19.0
root@OpenHAB:/opt/zigbee2mqtt# npm --version
6.14.4
root@OpenHAB:/opt/zigbee2mqtt# node-pre-gyp info ok
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.10.2
node-pre-gyp info using node@10.19.0 | linux | x64
node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack Error: Cannot find module 'aws-sdk'
node-pre-gyp ERR! stack     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
node-pre-gyp ERR! stack     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
node-pre-gyp ERR! stack     at Module.require (internal/modules/cjs/loader.js:692:17)
node-pre-gyp ERR! stack     at require (internal/modules/cjs/helpers.js:25:18)
node-pre-gyp ERR! stack     at unpublish (/usr/lib/nodejs/node-pre-gyp/lib/info.js:14:15)
node-pre-gyp ERR! stack     at Object.self.commands.(anonymous function) [as info] (/usr/lib/nodejs/node-pre-gyp/lib/node-pre-gyp.js:52:37)
node-pre-gyp ERR! stack     at run (/usr/lib/nodejs/node-pre-gyp/bin/node-pre-gyp:82:30)
node-pre-gyp ERR! stack     at Object.<anonymous> (/usr/lib/nodejs/node-pre-gyp/bin/node-pre-gyp:134:1)
node-pre-gyp ERR! stack     at Module._compile (internal/modules/cjs/loader.js:778:30)
node-pre-gyp ERR! stack     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
node-pre-gyp ERR! System Linux 5.8.0-53-generic
node-pre-gyp ERR! command "/usr/bin/node" "/usr/bin/node-pre-gyp" "info" "ok"
node-pre-gyp ERR! cwd /opt/zigbee2mqtt
node-pre-gyp ERR! node -v v10.19.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.2
node-pre-gyp ERR! This is a bug in `node-pre-gyp`.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp ERR!     <https://github.com/mapbox/node-pre-gyp/issues>

I manually installed aws-sdk, its in the folder node_modules, but this still does not help

root@OpenHAB:/opt/zigbee2mqtt# ls node_modules/
@babel                            esprima                           jest-resolve                           rimraf
@bcoe                             esquery                           jest-resolve-dependencies              rsvp
@cnakazawa                        esrecurse                         jest-runner                            run-parallel
@dabh                             estraverse                        jest-runtime                           safe-buffer
@eslint                           esutils                           jest-serializer                        safe-regex
@istanbuljs                       etag                              jest-snapshot                          safer-buffer
@jest                             event-emitter                     jest-util                              sane
@nodelib                          events                            jest-validate                          sax
@sinonjs                          exec-sh                           jest-watcher                           saxes
@types                            execa                             jest-worker                            semver
@typescript-eslint                exit                              jmespath                               send
abab                              expand-brackets                   js-tokens                              serve-static
acorn                             expect                            js-yaml                                set-blocking
acorn-globals                     ext                               jsbn                                   set-value
acorn-jsx                         extend                            jsdom                                  setprototypeof
acorn-walk                        extend-shallow                    jsesc                                  shebang-command
ajv                               extglob                           json-parse-even-better-errors          shebang-regex
ansi-colors                       extsprintf                        json-schema                            shellwords
ansi-escapes                      fast-deep-equal                   json-schema-traverse                   signal-exit
ansi-regex                        fast-glob                         json-stable-stringify-without-jsonify  simple-swizzle
ansi-styles                       fast-json-stable-stringify        json-stringify-safe                    sisteransi
anymatch                          fast-levenshtein                  json5                                  slash
argparse                          fast-safe-stringify               jsprim                                 slice-ansi
arr-diff                          fastq                             kind-of                                snapdragon
arr-flatten                       fb-watchman                       kleur                                  snapdragon-node
arr-union                         fecha                             kuler                                  snapdragon-util
array-union                       file-entry-cache                  leven                                  source-map
array-unique                      file-uri-to-path                  levn                                   source-map-resolve
asn1                              fill-range                        lines-and-columns                      source-map-support
assert-plus                       finalhandler                      locate-path                            source-map-url
assign-symbols                    find-up                           lodash                                 spdx-correct
astral-regex                      flat-cache                        lodash.sortby                          spdx-exceptions
async                             flatted                           logform                                spdx-expression-parse
asynckit                          fn.name                           lru-cache                              spdx-license-ids
atob                              for-in                            make-dir                               split-string
aws-sdk                           forever-agent                     makeerror                              split2
aws-sign2                         form-data                         map-cache                              sprintf-js
aws4                              fragment-cache                    map-visit                              sshpk
babel-jest                        fresh                             merge-stream                           stack-trace
babel-plugin-istanbul             fs.realpath                       merge2                                 stack-utils
babel-plugin-jest-hoist           fsevents                          micromatch                             static-extend
babel-preset-current-node-syntax  function-bind                     mime                                   statuses
babel-preset-jest                 functional-red-black-tree         mime-db                                stealthy-require
balanced-match                    gensync                           mime-types                             stream-shift
base                              get-caller-file                   mimic-fn                               string-length
base64-js                         get-package-type                  minimatch                              string-width
bcrypt-pbkdf                      get-stream                        minimist                               string_decoder
bindings                          get-value                         mixin-deep                             strip-ansi
bl                                getpass                           mkdir-recursive                        strip-bom
brace-expansion                   git-last-commit                   moment                                 strip-eof
braces                            glob                              mqtt                                   strip-final-newline
browser-process-hrtime            glob-parent                       mqtt-packet                            strip-json-comments
bser                              glob-stream                       ms                                     supports-color
buffer                            globals                           nan                                    supports-hyperlinks
buffer-from                       globby                            nanomatch                              symbol-tree
cache-base                        glossy                            natural-compare                        table
callback-stream                   graceful-fs                       next-tick                              terminal-link
callsites                         growly                            nice-try                               test-exclude
camelcase                         har-schema                        node-int64                             text-hex
capture-exit                      har-validator                     node-modules-regexp                    text-table
caseless                          has                               node-notifier                          throat
chalk                             has-flag                          normalize-package-data                 through2
char-regex                        has-value                         normalize-path                         through2-filter
ci-info                           has-values                        npm-run-path                           tmp
cjs-module-lexer                  help-me                           nwsapi                                 tmpl
class-utils                       hosted-git-info                   oauth-sign                             to-absolute-glob
cliui                             html-encoding-sniffer             object-assign-deep                     to-fast-properties
co                                html-escaper                      object-copy                            to-object-path
collect-v8-coverage               http-errors                       object-visit                           to-regex
collection-visit                  http-signature                    object.pick                            to-regex-range
color                             human-signals                     on-finished                            toidentifier
color-convert                     humanize-duration                 once                                   tough-cookie
color-name                        iconv-lite                        one-time                               tr46
color-string                      ieee754                           onetime                                triple-beam
colors                            ignore                            optionator                             tslib
colorspace                        import-fresh                      ordered-read-streams                   tsutils
combined-stream                   import-local                      p-each-series                          tunnel-agent
commist                           imurmurhash                       p-finally                              tweetnacl
component-emitter                 inflight                          p-limit                                type
concat-map                        inherits                          p-locate                               type-check
concat-stream                     ip-regex                          p-try                                  type-detect
convert-source-map                is-absolute                       parent-module                          type-fest
copy-descriptor                   is-accessor-descriptor            parse-json                             typedarray
core-util-is                      is-arrayish                       parse5                                 typedarray-to-buffer
cross-spawn                       is-buffer                         parseurl                               unc-path-regex
cssom                             is-ci                             pascalcase                             union-value
cssstyle                          is-core-module                    path-dirname                           unique-stream
d                                 is-data-descriptor                path-exists                            unix-dgram
dashdash                          is-descriptor                     path-is-absolute                       unpipe
data-urls                         is-docker                         path-key                               unset-value
debounce                          is-extendable                     path-parse                             uri-js
debug                             is-extglob                        path-type                              urix
decamelize                        is-fullwidth-code-point           performance-now                        url
decimal.js                        is-generator-fn                   picomatch                              use
decode-uri-component              is-glob                           pirates                                util-deprecate
deep-is                           is-negated-glob                   pkg-dir                                uuid
deepmerge                         is-number                         posix-character-classes                v8-compile-cache
define-property                   is-plain-object                   prelude-ls                             v8-to-istanbul
delayed-stream                    is-potential-custom-element-name  pretty-format                          validate-npm-package-license
depd                              is-relative                       process-nextick-args                   verror
destroy                           is-stream                         progress                               w3c-hr-time
detect-newline                    is-typedarray                     prompts                                w3c-xmlserializer
diff-sequences                    is-unc-path                       psl                                    walker
dir-glob                          is-windows                        pump                                   webidl-conversions
doctrine                          is-wsl                            pumpify                                whatwg-encoding
domexception                      isarray                           punycode                               whatwg-mimetype
duplexify                         isexe                             qs                                     whatwg-url
ecc-jsbn                          isobject                          querystring                            which
ee-first                          isstream                          range-parser                           which-module
emittery                          istanbul-lib-coverage             react-is                               winston
emoji-regex                       istanbul-lib-instrument           read-pkg                               winston-syslog
enabled                           istanbul-lib-report               read-pkg-up                            winston-transport
encodeurl                         istanbul-lib-source-maps          readable-stream                        word-wrap
end-of-stream                     istanbul-reports                  regex-not                              wrap-ansi
enquirer                          jest                              regexpp                                wrappy
error-ex                          jest-changed-files                reinterval                             write-file-atomic
es5-ext                           jest-config                       remove-trailing-separator              ws
es6-iterator                      jest-diff                         repeat-element                         xml-name-validator
es6-map                           jest-docblock                     repeat-string                          xml2js
es6-set                           jest-each                         request                                xmlbuilder
es6-symbol                        jest-environment-jsdom            request-promise-core                   xmlchars
escape-html                       jest-environment-node             request-promise-native                 xtend
escape-string-regexp              jest-get-type                     require-directory                      y18n
escodegen                         jest-haste-map                    require-from-string                    yallist
eslint                            jest-jasmine2                     require-main-filename                  yargs
eslint-config-google              jest-leak-detector                resolve                                yargs-parser
eslint-plugin-jest                jest-matcher-utils                resolve-cwd                            zigbee-herdsman
eslint-scope                      jest-message-util                 resolve-from                           zigbee-herdsman-converters
eslint-utils                      jest-mock                         resolve-url                            zigbee2mqtt-frontend
eslint-visitor-keys               jest-pnp-resolver                 ret
espree                            jest-regex-util                   reusify

root@OpenHAB:/opt/zigbee2mqtt# node-pre-gyp info ok

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.10.2
node-pre-gyp info using node@10.19.0 | linux | x64
node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack Error: Cannot find module 'aws-sdk'
node-pre-gyp ERR! stack     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
node-pre-gyp ERR! stack     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
node-pre-gyp ERR! stack     at Module.require (internal/modules/cjs/loader.js:692:17)
node-pre-gyp ERR! stack     at require (internal/modules/cjs/helpers.js:25:18)
node-pre-gyp ERR! stack     at unpublish (/usr/lib/nodejs/node-pre-gyp/lib/info.js:14:15)
node-pre-gyp ERR! stack     at Object.self.commands.(anonymous function) [as info] (/usr/lib/nodejs/node-pre-gyp/lib/node-pre-gyp.js:52:37)
node-pre-gyp ERR! stack     at run (/usr/lib/nodejs/node-pre-gyp/bin/node-pre-gyp:82:30)
node-pre-gyp ERR! stack     at Object.<anonymous> (/usr/lib/nodejs/node-pre-gyp/bin/node-pre-gyp:134:1)
node-pre-gyp ERR! stack     at Module._compile (internal/modules/cjs/loader.js:778:30)
node-pre-gyp ERR! stack     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
node-pre-gyp ERR! System Linux 5.8.0-53-generic
node-pre-gyp ERR! command "/usr/bin/node" "/usr/bin/node-pre-gyp" "info" "ok"
node-pre-gyp ERR! cwd /opt/zigbee2mqtt
node-pre-gyp ERR! node -v v10.19.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.2
node-pre-gyp ERR! This is a bug in `node-pre-gyp`.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp ERR!     <https://github.com/mapbox/node-pre-gyp/issues>
root@OpenHAB:/opt/zigbee2mqtt#

Whilst many people use zigbee2mqtt together with openHAB, it’s a completely separate project with different support channels.

Your queries are best suited over at https://www.zigbee2mqtt.io/. Choose Support from the menu.

1 Like

Thanks!

for anyone interested, I started the discussion here:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.