Open9

RaspberryPiでnobleを使おうとしたら怒られたので対応をメモ

光岡 高宏光岡 高宏

環境

  • ハード:Raspberry Pi 4B
  • OS:Raspberry Pi OS
  • Node.js:v14.17.6
  • npm:6.14.15
光岡 高宏光岡 高宏

発生したエラー

Error: The module '/home/pi/leafony-beacon/spreadsheet-logger/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/pi/leafony-beacon/spreadsheet-logger/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:6:15)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

NODE_MODULE_VERSION 64が要求されているけど、お前NODE_MODULE_VERSION 83を使っているよ、と言われている。

光岡 高宏光岡 高宏

ということで、NODE_MODULE_VERSION64のバージョンをインストールします。
今回はv10.24.1をチョイス。

光岡 高宏光岡 高宏

ターミナルを開き、以下のコマンドを実行しNode.jsをダウンロードします。

wget https://nodejs.org/download/release/v10.24.1/node-v10.24.1-linux-armv7l.tar.xz