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.

Build fail on Node.js 12

See original GitHub issue
$ npm install usb

> node-hid@0.7.8 install /home/paul/factom/ledger-test/node_modules/node-hid
> prebuild-install || node-gyp rebuild


> usb@1.5.0 install /home/paul/factom/ledger-test/node_modules/usb
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/tessel/node-usb/releases/download/1.5.0/usb_bindings-v1.5.0-node-v72-linux-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for usb@1.5.0 and node@12.2.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
make: Entering directory '/home/paul/factom/ledger-test/node_modules/usb/build'
  CC(target) Release/obj.target/libusb/libusb/libusb/core.o
  CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
  CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
  CC(target) Release/obj.target/libusb/libusb/libusb/io.o
  CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
  CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
  CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
  CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
  CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
  CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
  AR(target) Release/obj.target/usb.a
  COPY Release/usb.a
  CXX(target) Release/obj.target/usb_bindings/src/node_usb.o
../src/node_usb.cc: In function ‘void Initialize(v8::Local<v8::Object>)’:
../src/node_usb.cc:66:84: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  target->Set(Nan::New<String>("INIT_ERROR").ToLocalChecked(), Nan::New<Number>(res));
                                                                                    ^
In file included from /home/paul/.node-gyp/12.2.0/include/node/v8-internal.h:14:0,
                 from /home/paul/.node-gyp/12.2.0/include/node/v8.h:25,
                 from ../src/node_usb.h:12,
                 from ../src/node_usb.cc:1:
/home/paul/.node-gyp/12.2.0/include/node/v8.h:3359:26: note: declared here
                     bool Set(Local<Value> key, Local<Value> value));
                          ^
/home/paul/.node-gyp/12.2.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/node_usb.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE SetDebugLevel(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/node_usb.cc:99:73: error: no matching function for call to ‘v8::Value::Uint32Value()’
  if (info.Length() != 1 || !info[0]->IsUint32() || info[0]->Uint32Value() > 4) {
                                                                         ^
In file included from ../src/node_usb.h:12:0,
                 from ../src/node_usb.cc:1:
/home/paul/.node-gyp/12.2.0/include/node/v8.h:2567:41: note: candidate: v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
                                         ^~~~~~~~~~~
/home/paul/.node-gyp/12.2.0/include/node/v8.h:2567:41: note:   candidate expects 1 argument, 0 provided
../src/node_usb.cc:103:53: error: no matching function for call to ‘v8::Value::Uint32Value()’
  libusb_set_debug(usb_context, info[0]->Uint32Value());
                                                     ^
In file included from ../src/node_usb.h:12:0,
                 from ../src/node_usb.cc:1:
/home/paul/.node-gyp/12.2.0/include/node/v8.h:2567:41: note: candidate: v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
                                         ^~~~~~~~~~~
/home/paul/.node-gyp/12.2.0/include/node/v8.h:2567:41: note:   candidate expects 1 argument, 0 provided
../src/node_usb.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE GetDeviceList(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/node_usb.cc:116:35: warning: ‘bool v8::Object::Set(uint32_t, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
   arr->Set(i, Device::get(devs[i]));
                                   ^
In file included from /home/paul/.node-gyp/12.2.0/include/node/v8-internal.h:14:0,
                 from /home/paul/.node-gyp/12.2.0/include/node/v8.h:25,
                 from ../src/node_usb.h:12,
                 from ../src/node_usb.cc:1:
/home/paul/.node-gyp/12.2.0/include/node/v8.h:3368:26: note: declared here
                     bool Set(uint32_t index, Local<Value> value));
                          ^
/home/paul/.node-gyp/12.2.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/node_usb.cc: In function ‘void handleHotplug(std::pair<libusb_device*, libusb_hotplug_event>)’:
../src/node_usb.cc:151:58: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
  Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv);
                                                          ^
In file included from ../src/helpers.h:3:0,
                 from ../src/node_usb.h:21,
                 from ../src/node_usb.cc:1:
../../nan/nan.h:1001:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
../src/node_usb.cc: In function ‘v8::Local<v8::Value> libusbException(int)’:
../src/node_usb.cc:301:14: error: no matching function for call to ‘v8::Value::ToObject()’
  e->ToObject()->Set(Nan::New<String>("errno").ToLocalChecked(), Nan::New<Integer>(errorno));
              ^
In file included from ../src/node_usb.h:12:0,
                 from ../src/node_usb.cc:1:
/home/paul/.node-gyp/12.2.0/include/node/v8.h:2532:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                            ^~~~~~~~
/home/paul/.node-gyp/12.2.0/include/node/v8.h:2532:44: note:   candidate expects 1 argument, 0 provided
In file included from /home/paul/.node-gyp/12.2.0/include/node/v8-internal.h:14:0,
                 from /home/paul/.node-gyp/12.2.0/include/node/v8.h:25,
                 from ../src/node_usb.h:12,
                 from ../src/node_usb.cc:1:
/home/paul/.node-gyp/12.2.0/include/node/v8.h:2546:35: note: candidate: v8::Local<v8::Object> v8::Value::ToObject(v8::Isolate*) const
                     Local<Object> ToObject(Isolate* isolate) const);
                                   ^
/home/paul/.node-gyp/12.2.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
/home/paul/.node-gyp/12.2.0/include/node/v8.h:2546:35: note:   candidate expects 1 argument, 0 provided
                     Local<Object> ToObject(Isolate* isolate) const);
                                   ^
/home/paul/.node-gyp/12.2.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
usb_bindings.target.mk:118: recipe for target 'Release/obj.target/usb_bindings/src/node_usb.o' failed
make: *** [Release/obj.target/usb_bindings/src/node_usb.o] Error 1
make: Leaving directory '/home/paul/factom/ledger-test/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/paul/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:257:12)
gyp ERR! System Linux 4.15.0-48-generic
gyp ERR! command "/home/paul/.nvm/versions/node/v12.2.0/bin/node" "/home/paul/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/paul/factom/ledger-test/node_modules/usb/src/binding/usb_bindings.node" "--module_name=usb_bindings" "--module_path=/home/paul/factom/ledger-test/node_modules/usb/src/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/paul/factom/ledger-test/node_modules/usb
gyp ERR! node -v v12.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/paul/.nvm/versions/node/v12.2.0/bin/node /home/paul/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/paul/factom/ledger-test/node_modules/usb/src/binding/usb_bindings.node --module_name=usb_bindings --module_path=/home/paul/factom/ledger-test/node_modules/usb/src/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/paul/factom/ledger-test/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1011:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:268:5)
node-pre-gyp ERR! System Linux 4.15.0-48-generic
node-pre-gyp ERR! command "/home/paul/.nvm/versions/node/v12.2.0/bin/node" "/home/paul/factom/ledger-test/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/paul/factom/ledger-test/node_modules/usb
node-pre-gyp ERR! node -v v12.2.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/home/paul/.nvm/versions/node/v12.2.0/bin/node /home/paul/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/paul/factom/ledger-test/node_modules/usb/src/binding/usb_bindings.node --module_name=usb_bindings --module_path=/home/paul/factom/ledger-test/node_modules/usb/src/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN ledger-test@1.0.0 No description
npm WARN ledger-test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! usb@1.5.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the usb@1.5.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/paul/.npm/_logs/2019-05-15T14_54_40_833Z-debug.log

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kevinmehallcommented, May 15, 2019

Fixed on master by https://github.com/tessel/node-usb/pull/311, leaving this open to remind me to make a release.

0reactions
caffeinatedbitscommented, Sep 29, 2021

@Corben78 the Brother printer issue has now been resolved in node-serialport. See https://github.com/serialport/node-serialport/pull/2325

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build failure on Node 12.3.1 · Issue #1763 - GitHub
For me, the only way around this issue was to downgrade node.js version to 10. 12
Read more >
npm run build failing - node.js - Stack Overflow
I am trying to build my react and node. js web app but fail to build ever since fixing packages. Module not found:...
Read more >
Errors | Node.js v19.3.0 Documentation
Node.js generates system errors when exceptions occur within its runtime environment. These usually occur when an application violates an operating system ...
Read more >
Troubleshooting Node.js Deploys - Heroku Dev Center
Your Node.js deploy failed - now what? Start with these simple steps to troubleshoot a build issue. Check the buildpack.
Read more >
Error: Module build failed: Error: Node Sass does not yet ...
This error happened with me after upgrade of node.js. Cause: Node Sass version is not compatible with Node.js version. Solution: you should check...
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