Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module did not self-register @abandonware/bluetooth-hci-socket when building on Raspberry Pi (but works on MacOS) #348

Open
swissmilo opened this issue Jan 26, 2025 · 0 comments

Comments

@swissmilo
Copy link

I have a small home automation project that has been running fine on MacOS, but after porting it over to Raspberry Pi, I have not been able to resolve an error when trying to run node index.js.

I've spent quite a bit of time trying to triage the issue. I've reinstalled a clean version of Node, trying versions 20, 18, and 16. I've also moved everything inside a Docker container to get a clean install, with no success. Any pointers in the right direction would be appreciated.

sudo docker run --rm -it --net=host --privileged aranet_smarthome

Error Details:
Module did not self-register: '/usr/src/app/node_modules/@abandonware/bluetooth-hci-socket/build/Release/bluetooth_hci_socket.node'.

Stack Trace:
Error: Module did not self-register: '/usr/src/app/node_modules/@abandonware/bluetooth-hci-socket/build/Release/bluetooth_hci_socket.node'.
    at Module._extensions..node (node:internal/modules/cjs/loader:1460:18)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/usr/src/app/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:2:30)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)

Dockerfile

FROM node:18-bullseye

RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    python3 \
    bluetooth \
    bluez \
    libbluetooth-dev \
    libudev-dev \
    libcap2-bin \
    && rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/swissmilo/aranet_smarthome.git /usr/src/app

WORKDIR /usr/src/app

COPY .env ./

COPY package*.json ./

RUN npm install --build-from-source

RUN setcap cap_net_raw,cap_net_admin+eip `readlink -f \`which node\``

CMD ["npm", "start"]`

package-lock.json excerpt

"packages": {
    "": {
      "name": "aranet4-reader",
      "version": "1.0.0",
      "dependencies": {
        "@abandonware/noble": "^1.9.2-15",
        "@sendgrid/mail": "^8.1.4",
        "axios": "^1.6.7",
        "dotenv": "^16.4.1"
      }
    },
    "node_modules/@abandonware/bluetooth-hci-socket": {
      "version": "0.5.3-12",
      "resolved": "https://registry.npmjs.org/@abandonware/bluetooth-hci-socket/-/bluetooth-hci-socket-0.5.3-12.tgz",
      "integrity": "sha512-qo2cBoh94j6RPusaNXSLYI8Bzxuz01Bx3MD80a/QYzhHED/FZ6Y0k2w2kRbfIA2EEhFSCbXrBZDQlpilL4nbxA==",
      "hasInstallScript": true,
      "license": "MIT",
      "optional": true,
      "os": [
        "linux",
        "android",
        "freebsd",
        "win32"
      ],
      "dependencies": {
        "@mapbox/node-pre-gyp": "^1.0.11",
        "debug": "^4.3.4",
        "nan": "^2.18.0",
        "node-gyp": "^10.0.1"
      },
      "engines": {
        "node": ">=10.0.0"
      },
      "optionalDependencies": {
        "usb": "^2.11.0"
      }
    },
    "node_modules/@abandonware/noble": {
      "version": "1.9.2-15",
      "resolved": "https://registry.npmjs.org/@abandonware/noble/-/noble-1.9.2-15.tgz",
      "integrity": "sha512-qD9NN5fzvbtHdWYFPDzxY2AveILvDSRX/PTdL0V+CUfyF70ggIJtLBc1WW1hbVMIpu8rZylYgrK+PUEBwIpjCg==",
      "hasInstallScript": true,
      "license": "MIT",
      "os": [
        "darwin",
        "linux",
        "freebsd",
        "win32"
      ],
      "dependencies": {
        "debug": "^4.3.1",
        "node-addon-api": "^3.2.0"
      },
      "engines": {
        "node": ">=6"
      },
      "optionalDependencies": {
        "@abandonware/bluetooth-hci-socket": "^0.5.3-8"
      }
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant