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

**URL:** <https://forums.balena.io/t/build-fails-when-trying-to-use-node-js-noble-library-on-raspberry-pi-zero-w/2149>\
**Category:** Product support\
**Created:** [November 7, 2017, 10:43pm UTC](https://forums.balena.io/t/build-fails-when-trying-to-use-node-js-noble-library-on-raspberry-pi-zero-w/2149 "2017-11-07T22:43:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rblaakmeer](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@rblaakmeer](https://forums.balena.io/u/rblaakmeer)\
**Post date:** [November 7, 2017, 10:43pm UTC](https://forums.balena.io/t/build-fails-when-trying-to-use-node-js-noble-library-on-raspberry-pi-zero-w/2149/1 "2017-11-07T22:43:13Z")

</div>

I’m trying to use the Noble library, a Node.js BLE (Bluetooth Low Energy) central module, on a Raspberry PI Zero W. ([https://github.com/sandeepmistry/noble](https://github.com/sandeepmistry/noble))  
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?

---

<div class="post-metadata">

**Author:** ![CameronDiver](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@CameronDiver](https://forums.balena.io/u/CameronDiver)\
**Post date:** [November 7, 2017, 10:48pm UTC](https://forums.balena.io/t/build-fails-when-trying-to-use-node-js-noble-library-on-raspberry-pi-zero-w/2149/3 "2017-11-07T22:48:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rblaakmeer](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@rblaakmeer](https://forums.balena.io/u/rblaakmeer)\
**Post date:** [November 8, 2017, 5:56am UTC](https://forums.balena.io/t/build-fails-when-trying-to-use-node-js-noble-library-on-raspberry-pi-zero-w/2149/4 "2017-11-08T05:56:39Z")

</div>

Hi, this is my dockerfile:

FROM resin/%%RESIN\_MACHINE\_NAME%%-node  
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 . ./  
ENV INITSYSTEM on  
CMD [“npm”, “start”]`

---

<div class="post-metadata">

**Author:** ![rblaakmeer](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@rblaakmeer](https://forums.balena.io/u/rblaakmeer)\
**Post date:** [November 8, 2017, 7:29am UTC](https://forums.balena.io/t/build-fails-when-trying-to-use-node-js-noble-library-on-raspberry-pi-zero-w/2149/5 "2017-11-08T07:29:49Z")

</div>

Found the solution in this post: [Npm notice created a lockfile as package-lock.json. You should commit this file](https://forums.balena.io/t/npm-notice-created-a-lockfile-as-package-lock-json-you-should-commit-this-file/1316)

Updating

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

to

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

did the trick.

---

<div class="post-metadata">

**Author:** ![CameronDiver](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@CameronDiver](https://forums.balena.io/u/CameronDiver)\
**Post date:** [November 8, 2017, 11:50am UTC](https://forums.balena.io/t/build-fails-when-trying-to-use-node-js-noble-library-on-raspberry-pi-zero-w/2149/6 "2017-11-08T11:50:19Z")

</div>

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`
