Build fails when trying to use Node.js Noble library on Raspberry PI Zero W


I’m trying to use the Noble library, a Node.js BLE (Bluetooth Low Energy) central module, on a Raspberry PI Zero W. (
I added the required dependencies to the Dockerfile.template and added the noble dependency in package.json

At step 5/8 in the build process, the following line is displayed:
node-pre-gyp info check checked for “/usr/src/app/node_modules/usb/src/binding/usb_bindings.node” (not found)
and a rebuild of the usb-bindings is started. A lot of deprecated warnings are displayed.
The build ends with these messages:

[Build] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (node_modules/xpc-connection):
[Build] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm”})

[Error] Build failed: The command ‘/bin/sh -c JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*’ returned a non-zero code: 1

The rpi3-bluetooth sample did work successfully

Can anyone shed some light on this?


Hey @rblaakmeer

Those errors that you posted look like optional dependencies, which shouldn’t affect the build. Would you be able to post your dockerfile?


Hi, this is my dockerfile:

RUN apt-get update && apt-get install -yq
bluetooth bluez libbluetooth-dev libudev-dev bluez-firmware &&
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY package.json package.json
RUN JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*
COPY . ./
CMD [“npm”, “start”]`


Found the solution in this post: Npm notice created a lockfile as package-lock.json. You should commit this file


RUN JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*


RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*

did the trick.


Yeah, glad you found the culprit. I don’t think you want to use cache verify instead though, as this makes the task a no-op in terms of image size. What I would recommend is npm cache clean --force which will actually remove the cache, making your image smaller.

Alternatively you can tag the base image so that it will stick to node v6 (more importantly npm v4), using FROM resin/%%RESIN_MACHINE_NAME%%-node:6