question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

noble installation fails for node version 10 on Linux

See original GitHub issue

I tried to use noble with node version 10.4.0 but the package installation failed on Ubuntu 18.04 and Debian Jessie with installed libudev-dev package.

noble installation works as expected with node version 9.3.0 on Ubuntu 18.04. MacOS seems to have a simliar issue, cf. #791 .

Recreate the issue (natively - on Ubuntu 18.04)

  1. node version 10.4.0 installed
  2. sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
  3. npm install noble

Recreate the issue (in a docker container - on Debian Jessie)

  1. Save the following to a Dockerfile.
    FROM node:10
    
    RUN apt-get update && \
      apt-get install --assume-yes libudev-dev && \
      rm --recursive --force /var/lib/apt/lists/*
    
    RUN setcap cap_net_raw+eip $(readlink --canonicalize `which node`)
    
    CMD ["npm", "install", "noble"]
    
  2. In the folder that contains the above Dockerfile, run docker build --tag noble-node10-error ..
  3. In the folder that contains the above Dockerfile, run docker run --rm noble-node10-error.

Outcome

/tmp/noble-node10-error$ node --version
v10.4.0
/tmp/noble-node10-error$ npm install noble

> usb@1.3.1 install /tmp/noble-node10-error/node_modules/usb
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/tessel/node-usb/releases/download/1.3.1/usb_bindings-v1.3.1-node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for usb@1.3.1 and node@10.4.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
make: Entering directory '/tmp/noble-node10-error/node_modules/usb/build'
  CC(target) Release/obj.target/libusb/libusb/libusb/core.o
node-pre-gyp ERR! Tried to download(undefined): https://github.com/tessel/node-usb/releases/download/1.3.1/usb_bindings-v1.3.1-node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for usb@1.3.1 and node@10.4.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
../libusb/libusb/core.c:2342:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/libusb/libusb/libusb/core.o.d.raw: No such file or directory
 }
 ^
compilation terminated.
libusb.target.mk:134: recipe for target 'Release/obj.target/libusb/libusb/libusb/core.o' failed
make: *** [Release/obj.target/libusb/libusb/libusb/core.o] Error 1
make: Leaving directory '/tmp/noble-node10-error/node_modules/usb/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/user/.nvm/versions/node/v10.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.15.0-22-generic
gyp ERR! command "/home/user/.nvm/versions/node/v10.4.0/bin/node" "/home/user/.nvm/versions/node/v10.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/tmp/noble-node10-error/node_modules/usb/src/binding/usb_bindings.node" "--module_name=usb_bindings" "--module_path=/tmp/noble-node10-error/node_modules/usb/src/binding"
gyp ERR! cwd /tmp/noble-node10-error/node_modules/usb
gyp ERR! node -v v10.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/user/.nvm/versions/node/v10.4.0/bin/node /home/user/.nvm/versions/node/v10.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/noble-node10-error/node_modules/usb/src/binding/usb_bindings.node --module_name=usb_bindings --module_path=/tmp/noble-node10-error/node_modules/usb/src/binding' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/tmp/noble-node10-error/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Linux 4.15.0-22-generic
node-pre-gyp ERR! command "/home/user/.nvm/versions/node/v10.4.0/bin/node" "/tmp/noble-node10-error/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /tmp/noble-node10-error/node_modules/usb
node-pre-gyp ERR! node -v v10.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
Failed to execute '/home/user/.nvm/versions/node/v10.4.0/bin/node /home/user/.nvm/versions/node/v10.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/noble-node10-error/node_modules/usb/src/binding/usb_bindings.node --module_name=usb_bindings --module_path=/tmp/noble-node10-error/node_modules/usb/src/binding' (1)

> bluetooth-hci-socket@0.5.1 install /tmp/noble-node10-error/node_modules/bluetooth-hci-socket
> node-gyp rebuild

make: Entering directory '/tmp/noble-node10-error/node_modules/bluetooth-hci-socket/build'
  CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::poll()’:
../src/BluetoothHciSocket.cpp:251:95: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
     Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
                                                                                               ^
In file included from ../src/BluetoothHciSocket.cpp:8:0:
../../nan/nan.h:950:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::emitErrnoError()’:
../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local<v8::Value> [1])’
   Local<Value> error = errorConstructor->NewInstance(1, constructorArgs);
                                                                        ^
In file included from /home/user/.node-gyp/10.4.0/include/node/node.h:63:0,
                 from /home/user/.node-gyp/10.4.0/include/node/node_buffer.h:25,
                 from ../src/BluetoothHciSocket.cpp:7:
/home/user/.node-gyp/10.4.0/include/node/v8.h:3905:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^~~~~~~~~~~
/home/user/.node-gyp/10.4.0/include/node/v8.h:3905:44: note:   candidate expects 3 arguments, 2 provided
/home/user/.node-gyp/10.4.0/include/node/v8.h:3908:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^~~~~~~~~~~
/home/user/.node-gyp/10.4.0/include/node/v8.h:3908:44: note:   candidate expects 1 argument, 2 provided
../src/BluetoothHciSocket.cpp:282:93: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
   Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
                                                                                             ^
In file included from ../src/BluetoothHciSocket.cpp:8:0:
../../nan/nan.h:950:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
binding.target.mk:95: recipe for target 'Release/obj.target/binding/src/BluetoothHciSocket.o' failed
make: *** [Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1
make: Leaving directory '/tmp/noble-node10-error/node_modules/bluetooth-hci-socket/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/user/.nvm/versions/node/v10.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.15.0-22-generic
gyp ERR! command "/home/user/.nvm/versions/node/v10.4.0/bin/node" "/home/user/.nvm/versions/node/v10.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/noble-node10-error/node_modules/bluetooth-hci-socket
gyp ERR! node -v v10.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN saveError ENOENT: no such file or directory, open '/tmp/noble-node10-error/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/tmp/noble-node10-error/package.json'
npm WARN noble-node10-error No description
npm WARN noble-node10-error No repository field.
npm WARN noble-node10-error No README data
npm WARN noble-node10-error No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (node_modules/xpc-connection):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.3.1 (node_modules/usb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.3.1 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/bluetooth-hci-socket):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ noble@1.9.1
added 4 packages from 4 contributors and audited 278 packages in 3.778s
found 11 vulnerabilities (3 low, 8 moderate)
  run `npm audit fix` to fix them, or `npm audit` for details

Expected outcome:

  • Successful installation without errors / skipping the dependencies usb@1.3.1 and bluetooth-hci-socket@0.5.1.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jrobesoncommented, Sep 15, 2018

you folks could try my refactor PR if you feel like it. It does way more than fix the node 10 issue https://github.com/noble/noble/pull/823. Alternatively you could force the bluetooth-hci-socket PR here: https://github.com/noble/node-bluetooth-hci-socket/pull/91

I’ve basically gone beyond all this and converted all of noble to typescript for my own personal usage. I’m attempting to keep the public API the same , at least initially.

2reactions
jrobesoncommented, Jun 18, 2018

The bug is actually in bluetooth-hci-socket and the bug with a potential fix is here: https://github.com/noble/node-bluetooth-hci-socket/issues/84

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem installing nodejs version >= 10 on Linux Mint 19.3 ...
Use the installation script that corresponds to the version of Node.js you wish to install. e.g.. https://deb.nodesource.com/setup_12.x — Node.
Read more >
Error: Cannot find module '@abandonware/noble'
Hi, I am trying to run my customized node on Raspberry Pi 4 that runs DietPi OS. But, I am having errors along...
Read more >
@abandonware/noble - npm
A Node.js BLE (Bluetooth Low Energy) central library.. Latest version: 1.9.2-15, last published: a year ago. Start using @abandonware/noble ...
Read more >
Problem with node-red-contrib-generic-ble installation - 272836
Hi,. I don't see the exact error or how to solve the problem, but it seems that the problem is related to NodeJS...
Read more >
Prevent npm install for not supported Node.js versions
If a project includes an .npmrc that defines a strict engine, people cannot run npm install if their Node.js is not fulfilling the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found