Code Monkey home page Code Monkey logo

node-udev's Introduction

node-udev - list devices in system and detect changes on them

This library attempts to follow the libudev where it makes sense. I only needed some usb input device detection so I was happy with quite few features.

Requires node-v10.0.0, nan and libudev.

Installation

npm install udev

Installation on debian/ubuntu

sudo apt-get install libudev-dev
npm install udev

How to Use

The example below lists devices and monitors udev events on the ipnut subsystem until receiving an add event. The code is separately listed in samples/howto.js.

var udev = require("udev");

console.log(udev.list()); // this is a long list :)

var monitor = udev.monitor("input");
monitor.on('add', function (device) {
    console.log('added ' + device);
    monitor.close() // this closes the monitor.
});
monitor.on('remove', function (device) {
    console.log('removed ' + device);
});
monitor.on('change', function (device) {
    console.log('changed ' + device);
});

The example below lists devices belonging to subsystem "tty" i.e. various serial ports.

var udev = require('udev');
console.log(udev.list('tty'));

node-udev's People

Contributors

cheery avatar dependabot[bot] avatar gaikwadpratik avatar geiseri avatar hinnerk avatar imyller avatar jonathan-k4 avatar kdomanski avatar kekec852 avatar m0g avatar micsurin avatar morganrallen avatar zensey avatar zvin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-udev's Issues

Promises don't work in the monitor callback!

const udev = require('udev');
const monitor = udev.monitor();

monitor.on('add', () => {
  console.log('1');
  Promise.resolve()
  .then(() => {
    console.log('2');
  })
  .then(() => {
    console.log('3');
  });
});

Output should be:

1
2
3

Output is

1

However if you do

monitor.on('add', () => {
  console.log('1');
  setTimeout(() => {
    Promise.resolve()
    .then(() => {
      console.log('2');
    })
    .then(() => {
      console.log('3');
    });
  })
});

Then the output is

1
2
3

ValueError: invalid mode: 'rU' while trying to load binding.gyp

Fails to install on Fedora FC38.

node v18.16.0
npm 6.14.8
python 3.11.3

Possible solution: https://stackoverflow.com/questions/74715990/node-gyp-err-invalid-mode-ru-while-trying-to-load-binding-gyp

$ npm i udev

> @serialport/[email protected] install /opt/iobroker/node_modules/@serialport/bindings-cpp
> node-gyp-build


> [email protected] install /opt/iobroker/node_modules/unix-dgram
> node-gyp rebuild

(node:7023) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
Traceback (most recent call last):
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
             ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
    return main(sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 520, in gyp_main
    [generator, flat_list, targets, data] = Load(
                                            ^^^^^
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 136, in Load
    result = gyp.input.Load(build_files, default_variables, includes[:],
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2782, in Load
    LoadTargetBuildFile(build_file, data, aux_data,
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile
    build_file_data = LoadOneBuildFile(build_file_path, data, aux_data,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 234, in LoadOneBuildFile
    build_file_contents = open(build_file_path, 'rU').read()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU' while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 6.3.4-201.fc38.x86_64
gyp ERR! command "/usr/bin/node-18" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/iobroker/node_modules/unix-dgram
gyp ERR! node -v v18.16.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

Reimplementation in N-API

As a response to discussion on the issue #32, we examine the possibility to reimplement the library with N-API. The motivation to do this change is that this interface is purported to be ABI-stable.

The secondary objective here is to also provide WebIDL specifications and TypeScript headers for the library, to allow easier interop from numerous languages that compile to Js.

This change is allowed to be backwards-breaking, and we will bump up the version number by major. Still the library users are considered. We will document why the interface changes, for each function. We also attempt to keep the new library useful for the same things the previous library was useful for.

Resources for the project:

  1. N-API documentation. Outright it seems quite good, easy to comprehend and comprehensive documentation for the library.
  2. WebIDL spec.
  3. WebIDL wikipedia entry.
  4. WebIDL binding generator an experimental tool to generate bindings from the WebIDL specs. I'm planning to examine this one and see how well it fares.

A new branch (v1) was created for the work toward the N-API bindings. Help is welcome and we will work on this together.

Incompatibility with latest node version

Using node v7.9.0 on Ubuntu 16.04, your module does not work. I had previously been using it with node v4.4.4 without issues.

Upon requiring your module, my application dies with this message:

#
# Fatal error in ../deps/v8/src/api.cc, line 1062
# Check failed: !value_obj->IsJSReceiver() || value_obj->IsTemplateInfo().
#

==== C stack trace ===============================

    node(v8::base::debug::StackTrace::StackTrace()+0x16) [0x1581cb6]
    node(V8_Fatal+0xd6) [0x157c9d6]
    node(v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)+0xf7) [0xa9c607]
    /home/bedroom/shs-new-dev/hydra-autodiscovery-refactor/node_modules/udev/build/Release/udev.node(+0x4234) [0x7fefa13e8234]
    node(node::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)+0x325) [0x12ba9c5]
    node(v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))+0x141) [0xac4a41]
    node() [0xb4702c]
    node(v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)+0x155) [0xb47525]
    [0x961432043a7]
Illegal instruction

I suspect this is due to changes within v8 and your usage around here:

https://github.com/cheery/node-udev/blob/master/udev.cc#L246

I've never dived too deeply into v8 internals, but I'd like to help out, but wanted to report this in case I could not create a PR for this issue.

Assertion `handle->InternalFieldCount() > 0' failed.

It works fine while I use the how-to-use example after npm install udev, but will meet error like
void node::ObjectWrap::Wrap(v8::Handle<v8::Object>): Assertion handle->InternalFieldCount() > 0' failed. Aborted (core dumped) after clone source code,npm i` and node the example.

OS: Ubuntu 14.04 64bits
nodejs: 1.2.0
npm: 2.5.1
libudev1: 204-5ubuntu20.11

The event handler fails to print out exception messages

In a related pull request, we may have spotted a bug. The bug causes the exceptions to be ignored silently inside the event handler.

To illustrate the problem, here's an example:

var util = require("util");
var udev = require("./udev.js");

var monitor = udev.monitor();
monitor.on('add', function (device) {
    console.log(device.DEVPATH + " added");
    throw new Error("Trycatch?");
});

The above example should result in an error logged, similar to the following program:

setTimeout(function(){
    console.log("timeout");
    throw new Error("Trycatch?");
}, 1);

There should be a handler in Node.js runtime that implements the behavior, it should be added into on_handle_event to resolve this issue.

unref assertion failing in some versions of libudev

Looks like there is an incorrect reference counting management with libudev in line 180 of udev.cc

image

According to the documentation:

https://manpages.debian.org/testing/libudev-dev/udev_device_get_parent.3.en.html

The function udev_device_get_parent do not increment the reference, and the child node have a reference to the returned device. In some version of libudev, this triggers an assertion and the program is aborted:

Assertion 'p->n_ref > 0' failed at src/libudev/libudev-device.c:502, function udev_device_unref(). Aborting.

Changing the code around line 180 to this seems to fix the issue:

  udev_device *parentDev = udev_device_get_parent(dev.get());

  if (!parentDev) {
    return env.Null();
  }

  Napi::Object obj = Napi::Object::New(env);
  PushProperties(env, obj, parentDev);
  const char *path = udev_device_get_syspath(parentDev);

Doesn't work with node 8.0.0

The console output from sudo npm install -g udev

> [email protected] install /usr/lib/node_modules/udev
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https:///node-v57-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp) 
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/udev/.node-gyp"
make: Entering directory '/usr/lib/node_modules/udev/build'
make: *** No rule to make target '../.node-gyp/8.0.0/include/node/common.gypi', needed by 'Makefile'.  Stop.
make: Leaving directory '/usr/lib/node_modules/udev/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Linux 4.11.3-1-ARCH
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/lib/node_modules/udev/build/node-v57-linux-x64/udev.node" "--module_name=udev" "--module_path=/usr/lib/node_modules/udev/build/node-v57-linux-x64"
gyp ERR! cwd /usr/lib/node_modules/udev
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/udev/build/node-v57-linux-x64/udev.node --module_name=udev --module_path=/usr/lib/node_modules/udev/build/node-v57-linux-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/udev/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:887:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
node-pre-gyp ERR! System Linux 4.11.3-1-ARCH
node-pre-gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/udev/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/udev
node-pre-gyp ERR! node -v v8.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.28
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/udev/build/node-v57-linux-x64/udev.node --module_name=udev --module_path=/usr/lib/node_modules/udev/build/node-v57-linux-x64' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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!     /root/.npm/_logs/2017-06-07T07_23_31_692Z-debug.log

What to do with this project? Your opportunity for feedback and suggestions.

Hello everybody.

I think I've been overlooking the people using this library and I'm sorry about that one. I think it could be much better if I had responded to you properly. Although I've been listening people for a long while, it's been a scary place to give me feedback. That has changed now though.

This library has 3 dependents with documentation and 2 dependencies. I suppose it's not a popular or widely used library, and there may be already much better libraries out there. I wonder what should we do here?

I haven't been interested about node or udev for years, but apparently there are weird things happening. People are building statically typed languages that use Javascript as a platform, forming something similar to the link between typed-lambda calculus <--> untyped lambda calculus. I think this can be a good possible future for node/npm and whole Javascript ecosystem. The flaws are eventually resolved, and who knows if Javascript itself changes to better.

There are quite a few projects that depend on this library. Apparently one library uses it to detect mountpoints, another uses it to detect serial ports, third one uses to find usbled devices. These are clear I guess.

So let me know, what do you think should happen to this library? Is there a better library out there already? Any frustrations or issues you have had, or proposals to fix the issues?

I barely remember I made this library and I feel like it's just a wrapper anyway. What am I even doing maintaining this? But then, there are some upcoming projects that might be relevant here. I have a C-FFI header generator that I would like to renovate. This would provide easy FFI-headers for any possible language runtime you are interested about. It might be interesting to use it in this connection, as a testbed.

Fails to build against Electron 1.4.15

After a plain install it fails with Module version mismatch.

Uncaught Exception:
Error: Module version mismatch. Expected 50, got 47.
    at Error (native)
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:583:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/******************************/node_modules/udev/udev.js:1:91)

Typically electron-rebuild can be used to rebuild against the present version of electron. This succeeds as expected but then the module mismatch results in a Fatal error.

#
# Fatal error in ../../v8/src/api.cc, line 1082
# Check failed: !value_obj->IsJSReceiver() || value_obj->IsTemplateInfo().
#

==== C stack trace ===============================

 1: V8_Fatal
 2: 0x7f3e6fef8ebd
 3: 0x7f3e5cd16234
 4: node::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)
 5: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))
 6: 0x7f3e6ff57b91
 7: 0x7f3e6ff7e60f
 8: 0x2b19d7306147

This is all I have for now, trying to figure out how to get a better stack trace.

Error building in Raspberry Pi (ARMv6)

OS: Debian GNU/Linux 7 (Raspbian)
libudev: libudev0:armhf 175-7.2
nodejs: 0.6.19dfsg1-6
npm: 1.1.4
dfsg-2

npm install udev

make: Entering directory `/root/gopropi/node_modules/udev/build'
CXX(target) Release/obj.target/udev/udev.o
../udev.cc:48:33: error: ‘uv_poll_t’ has not been declared
../udev.cc:94:5: error: ‘uv_poll_t’ does not name a type
../udev.cc: In static member function ‘static void Monitor::on_handle_event(int_, int, int)’:
../udev.cc:50:51: error: request for member ‘data’ in ‘_ handle’, which is of non-class type ‘int’
../udev.cc: In static member function ‘static v8::Handlev8::Value Monitor::New(const v8::Arguments&)’:
../udev.cc:71:9: error: ‘uv_poll_t’ was not declared in this scope
../udev.cc:71:20: error: ‘handle’ was not declared in this scope
../udev.cc:76:14: error: ‘class Monitor’ has no member named ‘poll_handle’
../udev.cc:76:41: error: expected type-specifier before ‘uv_poll_t’
../udev.cc:76:41: error: expected ‘;’ before ‘uv_poll_t’
../udev.cc:82:46: error: ‘class Monitor’ has no member named ‘poll_handle’
../udev.cc:82:66: error: ‘uv_poll_init’ was not declared in this scope
../udev.cc:83:28: error: ‘class Monitor’ has no member named ‘poll_handle’
../udev.cc:83:41: error: ‘UV_READABLE’ was not declared in this scope
../udev.cc:83:69: error: ‘uv_poll_start’ was not declared in this scope
../udev.cc: In static member function ‘static v8::Handlev8::Value Monitor::Close(const v8::Arguments&)’:
../udev.cc:89:27: error: ‘class Monitor’ has no member named ‘poll_handle’
../udev.cc:89:38: error: ‘uv_poll_stop’ was not declared in this scope
../udev.cc:90:37: error: ‘class Monitor’ has no member named ‘poll_handle’
make: *** [Release/obj.target/udev/udev.o] Error 1

Error building in Ubuntu 13.04

OS: Ubuntu 13.04 64bits
nodejs: 0.10.24
npm: 1.3.21
libudev1: 198-0ubuntu11

npm install udev

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'udev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink /usr/bin/node
5 verbose readDependencies using package.json deps
6 verbose cache add [ 'udev', null ]
7 verbose cache add name=undefined spec="udev" args=["udev",null]
8 verbose parsed url { protocol: null,
8 verbose parsed url   slashes: null,
8 verbose parsed url   auth: null,
8 verbose parsed url   host: null,
8 verbose parsed url   port: null,
8 verbose parsed url   hostname: null,
8 verbose parsed url   hash: null,
8 verbose parsed url   search: null,
8 verbose parsed url   query: null,
8 verbose parsed url   pathname: 'udev',
8 verbose parsed url   path: 'udev',
8 verbose parsed url   href: 'udev' }
9 silly lockFile ea73925a-udev udev
10 verbose lock udev /home/diosney/.npm/ea73925a-udev.lock
11 silly lockFile ea73925a-udev udev
12 silly lockFile ea73925a-udev udev
13 verbose addNamed [ 'udev', '' ]
14 verbose addNamed [ null, '*' ]
15 silly lockFile d2aa95c7-udev udev@
16 verbose lock udev@ /home/diosney/.npm/d2aa95c7-udev.lock
17 silly addNameRange { name: 'udev', range: '*', hasData: false }
18 verbose url raw udev
19 verbose url resolving [ 'https://registry.npmjs.org/', './udev' ]
20 verbose url resolved https://registry.npmjs.org/udev
21 info trying registry request attempt 1 at 10:55:12
22 verbose etag "86S17YPXKWXG69O0O0VHUQ44L"
23 http GET https://registry.npmjs.org/udev
24 http 304 https://registry.npmjs.org/udev
25 silly registry.get cb [ 304,
25 silly registry.get   { date: 'Fri, 03 Jan 2014 15:55:07 GMT',
25 silly registry.get     server: 'Apache',
25 silly registry.get     connection: 'Keep-Alive',
25 silly registry.get     'keep-alive': 'timeout=10, max=50',
25 silly registry.get     etag: '"86S17YPXKWXG69O0O0VHUQ44L"',
25 silly registry.get     vary: 'Accept' } ]
26 verbose etag udev from cache
27 silly addNameRange number 2 { name: 'udev', range: '*', hasData: true }
28 silly addNameRange versions [ 'udev', [ '0.1.0' ] ]
29 verbose addNamed [ 'udev', '0.1.0' ]
30 verbose addNamed [ '0.1.0', '0.1.0' ]
31 silly lockFile 836b14a6-udev-0-1-0 [email protected]
32 verbose lock [email protected] /home/diosney/.npm/836b14a6-udev-0-1-0.lock
33 silly lockFile 836b14a6-udev-0-1-0 [email protected]
34 silly lockFile 836b14a6-udev-0-1-0 [email protected]
35 silly lockFile d2aa95c7-udev udev@
36 silly lockFile d2aa95c7-udev udev@
37 silly resolved [ { name: 'udev',
37 silly resolved     version: '0.1.0',
37 silly resolved     description: 'Bindings to libudev',
37 silly resolved     main: 'udev.js',
37 silly resolved     scripts:
37 silly resolved      { test: 'echo "Error: no test specified" && exit 1',
37 silly resolved        install: 'node-gyp rebuild' },
37 silly resolved     repository: { type: 'git', url: 'https://github.com/cheery/node-udev' },
37 silly resolved     engines: { node: '>=0.8.0' },
37 silly resolved     keywords: [ 'udev', 'linux' ],
37 silly resolved     author: { name: 'Henri Tuhola', email: '[email protected]' },
37 silly resolved     license: 'BSD',
37 silly resolved     gypfile: true,
37 silly resolved     readmeFilename: 'README.md',
37 silly resolved     readme: '# node-udev - list devices in system and detect changes on them\n\nThis library attempts to follow the libudev where it makes sense. I only needed some usb input device detection so I was happy with quite few features.\n\nRequires node-v0.8.0 and libudev.\n\n## Installation\n\n    npm install udev\n\n## How to Use\n\n    var udev = require("udev");\n\n    console.log(udev.list()); // this is a long list :)\n\n    var monitor = udev.monitor();\n    monitor.on(\'add\', function (device) {\n        console.log(\'added \' + device);\n        monitor.close() // this closes the monitor.\n    });\n    monitor.on(\'remove\', function (device) {\n        console.log(\'removed \' + device);\n    });\n    monitor.on(\'change\', function (device) {\n        console.log(\'changed \' + device);\n    });\n',
37 silly resolved     bugs: { url: 'https://github.com/cheery/node-udev/issues' },
37 silly resolved     homepage: 'https://github.com/cheery/node-udev',
37 silly resolved     _id: '[email protected]',
37 silly resolved     _from: 'udev@' } ]
38 info install [email protected] into /home/diosney/Projects/App
39 info installOne [email protected]
40 info /home/diosney/Projects/App/node_modules/udev unbuild
41 verbose tar unpack /home/diosney/.npm/udev/0.1.0/package.tgz
42 silly lockFile 4fb274fb-rojects-App-node-modules-udev tar:///home/diosney/Projects/App/node_modules/udev
43 verbose lock tar:///home/diosney/Projects/App/node_modules/udev /home/diosney/.npm/4fb274fb-rojects-App-node-modules-udev.lock
44 silly lockFile b3255ed4-osney-npm-udev-0-1-0-package-tgz tar:///home/diosney/.npm/udev/0.1.0/package.tgz
45 verbose lock tar:///home/diosney/.npm/udev/0.1.0/package.tgz /home/diosney/.npm/b3255ed4-osney-npm-udev-0-1-0-package-tgz.lock
46 silly gunzTarPerm modes [ '755', '644' ]
47 silly gunzTarPerm extractEntry package.json
48 silly gunzTarPerm extractEntry README.md
49 silly gunzTarPerm extractEntry udev.js
50 silly gunzTarPerm extractEntry binding.gyp
51 silly gunzTarPerm extractEntry build/Makefile
52 silly gunzTarPerm extractEntry build/Release/.deps/Release/obj.target/udev/udev.o.d
53 silly gunzTarPerm extractEntry build/Release/.deps/Release/obj.target/udev.node.d
54 silly gunzTarPerm extractEntry build/Release/.deps/Release/udev.node.d
55 silly gunzTarPerm extractEntry build/Release/linker.lock
56 silly gunzTarPerm extractEntry build/Release/obj.target/udev/udev.o
57 silly gunzTarPerm extractEntry build/Release/obj.target/udev.node
58 silly gunzTarPerm extractEntry build/binding.Makefile
59 silly gunzTarPerm extractEntry build/config.gypi
60 silly gunzTarPerm extractEntry build/udev.target.mk
61 silly gunzTarPerm extractEntry demo.coffee
62 silly gunzTarPerm extractEntry udev.cc
63 silly lockFile 4fb274fb-rojects-App-node-modules-udev tar:///home/diosney/Projects/App/node_modules/udev
64 silly lockFile 4fb274fb-rojects-App-node-modules-udev tar:///home/diosney/Projects/App/node_modules/udev
65 silly lockFile b3255ed4-osney-npm-udev-0-1-0-package-tgz tar:///home/diosney/.npm/udev/0.1.0/package.tgz
66 silly lockFile b3255ed4-osney-npm-udev-0-1-0-package-tgz tar:///home/diosney/.npm/udev/0.1.0/package.tgz
67 info preinstall [email protected]
68 verbose readDependencies using package.json deps
69 verbose readDependencies using package.json deps
70 silly resolved []
71 verbose about to build /home/diosney/Projects/App/node_modules/udev
72 info build /home/diosney/Projects/App/node_modules/udev
73 verbose linkStuff [ false,
73 verbose linkStuff   false,
73 verbose linkStuff   false,
73 verbose linkStuff   '/home/diosney/Projects/App/node_modules' ]
74 info linkStuff [email protected]
75 verbose linkBins [email protected]
76 verbose linkMans [email protected]
77 verbose rebuildBundles [email protected]
78 info install [email protected]
79 verbose unsafe-perm in lifecycle true
80 info [email protected] Failed to exec install script
81 info /home/diosney/Projects/App/node_modules/udev unbuild
82 info preuninstall [email protected]
83 info uninstall [email protected]
84 verbose true,/home/diosney/Projects/App/node_modules,/home/diosney/Projects/App/node_modules unbuild [email protected]
85 info postuninstall [email protected]
86 error [email protected] install: `node-gyp rebuild`
86 error Exit status 1
87 error Failed at the [email protected] install script.
87 error This is most likely a problem with the udev package,
87 error not with npm itself.
87 error Tell the author that this fails on your system:
87 error     node-gyp rebuild
87 error You can get their info via:
87 error     npm owner ls udev
87 error There is likely additional logging output above.
88 error System Linux 3.8.0-35-generic
89 error command "/usr/bin/node" "/usr/bin/npm" "install" "udev"
90 error cwd /home/diosney/Projects/App
91 error node -v v0.10.24
92 error npm -v 1.3.21
93 error code ELIFECYCLE
94 verbose exit [ 1, true ]

type mismatch Error on install

npm install ConnectionSystems/node-udev

output on Raspberry Pi :

npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

> [email protected] install /home/pi/auto-usb/node_modules/udev
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Invalid URI "https:///node-v83-linux-arm.tar.gz"
make: Entering directory '/home/pi/auto-usb/node_modules/udev/build'
  CXX(target) Release/obj.target/udev/udev.o
In file included from ../../nan/nan.h:56,
                 from ../udev.cc:2:
/home/pi/.cache/node-gyp/14.17.2/include/node/node.h:758:43: warning: cast between incompatible function types from ‘void (*)(v8::Local<v8::Object>)’ to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/pi/.cache/node-gyp/14.17.2/include/node/node.h:792:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../udev.cc:295:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(udev, Init)
 ^~~~~~~~~~~
In file included from ../udev.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/pi/.cache/node-gyp/14.17.2/include/node/node_object_wrap.h:85:78:   required from here
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:10874:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:10874:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/udev.node
  COPY Release/udev.node
  COPY /home/pi/auto-usb/node_modules/udev/build/node-v83-linux-arm/udev.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/home/pi/auto-usb/node_modules/udev/build'
+ [email protected]
added 29 packages from 16 contributors and audited 177 packages in 27.159s

6 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

for now udev is working, but what to do about the type mismatch ?

doesn't install with node 0.12

I tried fixing it with https://github.com/rvagg/nan , not getting anywhere with it though

Here is the npm install errors:
.../node-udev $ npm install

[email protected] install /.../node_modules/node-udev
node-gyp rebuild

child_process: customFds option is deprecated, use stdio instead.
make: Entering directory '.../node_modules/node-udev/build'
CXX(target) Release/obj.target/udev/udev.o
../udev.cc: In function ‘void PushProperties(v8::Localv8::Object, udev_device_)’:
../udev.cc:19:22: error: ‘New’ is not a member of ‘v8::String’
../udev.cc:19:41: error: ‘New’ is not a member of ‘v8::String’
../udev.cc:21:22: error: ‘New’ is not a member of ‘v8::String’
../udev.cc:21:46: error: too few arguments to function ‘v8::Handlev8::Primitive v8::Null(v8::Isolate_)’
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:306:28: note: declared here
../udev.cc: At global scope:
../udev.cc:26:41: error: expected class-name before ‘{’ token
../udev.cc:41:33: error: ‘uv_handle_t’ has not been declared
../udev.cc:48:33: error: ‘uv_poll_t’ has not been declared
../udev.cc:69:36: error: ‘Arguments’ does not name a type
../udev.cc:69:47: error: ISO C++ forbids declaration of ‘args’ with no type [-fpermissive]
../udev.cc:86:38: error: ‘Arguments’ does not name a type
../udev.cc:86:49: error: ISO C++ forbids declaration of ‘args’ with no type [-fpermissive]
../udev.cc:94:5: error: ‘uv_poll_t’ does not name a type
../udev.cc: In static member function ‘static void Monitor::Init(v8::Handlev8::Object)’:
../udev.cc:32:64: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handlev8::Value (&)(const int&))’
../udev.cc:32:64: note: candidate is:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:3455:34: note: static v8::Localv8::FunctionTemplate v8::FunctionTemplate::New(v8::Isolate_, v8::FunctionCallback, v8::Handlev8::Value, v8::Handlev8::Signature, int)
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:3455:34: note: no known conversion for argument 1 from ‘v8::Handlev8::Value(const int&)’ to ‘v8::Isolate_’
../udev.cc:33:27: error: ‘NewSymbol’ is not a member of ‘v8::String’
../udev.cc:35:39: error: ‘NewSymbol’ is not a member of ‘v8::String’
../udev.cc:36:40: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handlev8::Value (&)(const int&))’
../udev.cc:36:40: note: candidate is:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:3455:34: note: static v8::Localv8::FunctionTemplate v8::FunctionTemplate::New(v8::Isolate_, v8::FunctionCallback, v8::Handlev8::Value, v8::Handlev8::Signature, int)
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:3455:34: note: no known conversion for argument 1 from ‘v8::Handlev8::Value(const int&)’ to ‘v8::Isolate_’
../udev.cc:37:88: error: no matching function for call to ‘v8::Persistentv8::Function::New(v8::Localv8::Function)’
../udev.cc:37:88: note: candidate is:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:5809:4: note: static T* v8::PersistentBase::New(v8::Isolate_, T_) [with T = v8::Function]
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:5809:4: note: candidate expects 2 arguments, 1 provided
../udev.cc:38:21: error: ‘NewSymbol’ is not a member of ‘v8::String’
../udev.cc: In static member function ‘static void Monitor::on_handle_close(int_)’:
../udev.cc:42:51: error: request for member ‘data’ in ‘_ handle’, which is of non-class type ‘int’
../udev.cc:43:23: error: ‘class v8::Persistentv8::Object’ has no member named ‘Dispose’
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h: In static member function ‘static void Monitor::on_handle_event(int_, int, int)’:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: error: ‘v8::HandleScope::HandleScope()’ is protected
../udev.cc:49:21: error: within this context
../udev.cc:50:51: error: request for member ‘data’ in ‘_ handle’, which is of non-class type ‘int’
../udev.cc:51:28: error: ‘ObjectWrap’ has not been declared
../udev.cc:51:54: error: expected primary-expression before ‘>’ token
../udev.cc:54:41: error: no matching function for call to ‘v8::Object::New()’
../udev.cc:54:41: note: candidate is:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:2388:24: note: static v8::Localv8::Object v8::Object::New(v8::Isolate_)
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:2388:24: note: candidate expects 1 argument, 0 provided
../udev.cc:55:18: error: ‘NewSymbol’ is not a member of ‘v8::String’
../udev.cc:55:48: error: ‘New’ is not a member of ‘v8::String’
../udev.cc:59:44: error: base operand of ‘->’ has non-pointer type ‘v8::Persistentv8::Object’
../udev.cc:59:50: error: ‘NewSymbol’ is not a member of ‘v8::String’
../udev.cc:62:23: error: ‘NewSymbol’ is not a member of ‘v8::String’
../udev.cc:64:46: error: no matching function for call to ‘v8::Function::Call(v8::Persistentv8::Object&, int, v8::Localv8::Value [2])’
../udev.cc:64:46: note: candidate is:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:2557:16: note: v8::Localv8::Value v8::Function::Call(v8::Handlev8::Value, int, v8::Handlev8::Value_)
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:2557:16: note: no known conversion for argument 1 from ‘v8::Persistentv8::Object’ to ‘v8::Handlev8::Value’
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h: In static member function ‘static v8::Handlev8::Value Monitor::New(const int&)’:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: error: ‘v8::HandleScope::HandleScope()’ is protected
../udev.cc:70:21: error: within this context
../udev.cc:71:9: error: ‘uv_poll_t’ was not declared in this scope
../udev.cc:71:20: error: ‘handle’ was not declared in this scope
../udev.cc:76:14: error: ‘class Monitor’ has no member named ‘poll_handle’
../udev.cc:76:41: error: expected type-specifier before ‘uv_poll_t’
../udev.cc:76:41: error: expected ‘;’ before ‘uv_poll_t’
../udev.cc:77:14: error: ‘class Monitor’ has no member named ‘Wrap’
../udev.cc:77:24: error: request for member ‘This’ in ‘args’, which is of non-class type ‘const int’
../udev.cc:80:54: error: request for member ‘This’ in ‘args’, which is of non-class type ‘const int’
../udev.cc:82:38: error: ‘uv_default_loop’ was not declared in this scope
../udev.cc:82:46: error: ‘class Monitor’ has no member named ‘poll_handle’
../udev.cc:82:66: error: ‘uv_poll_init’ was not declared in this scope
../udev.cc:83:28: error: ‘class Monitor’ has no member named ‘poll_handle’
../udev.cc:83:41: error: ‘UV_READABLE’ was not declared in this scope
../udev.cc:83:69: error: ‘uv_poll_start’ was not declared in this scope
../udev.cc:84:21: error: request for member ‘This’ in ‘args’, which is of non-class type ‘const int’
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h: In static member function ‘static v8::Handlev8::Value Monitor::Close(const int&)’:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: error: ‘v8::HandleScope::HandleScope()’ is protected
../udev.cc:87:21: error: within this context
../udev.cc:88:24: error: ‘ObjectWrap’ has not been declared
../udev.cc:88:50: error: expected primary-expression before ‘>’ token
../udev.cc:88:57: error: request for member ‘This’ in ‘args’, which is of non-class type ‘const int’
../udev.cc:89:27: error: ‘class Monitor’ has no member named ‘poll_handle’
../udev.cc:89:38: error: ‘uv_poll_stop’ was not declared in this scope
../udev.cc:90:19: error: ‘uv_handle_t’ was not declared in this scope
../udev.cc:90:31: error: expected primary-expression before ‘)’ token
../udev.cc:90:65: error: ‘uv_close’ was not declared in this scope
../udev.cc:92:22: error: ‘class v8::HandleScope’ has no member named ‘Close’
../udev.cc:92:38: error: too few arguments to function ‘v8::Handlev8::Primitive v8::Undefined(v8::Isolate_)’
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:305:28: note: declared here
../udev.cc: At global scope:
../udev.cc:99:33: error: ‘Arguments’ does not name a type
../udev.cc:99:44: error: ISO C++ forbids declaration of ‘args’ with no type [-fpermissive]
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h: In function ‘v8::Handlev8::Value List(const int&)’:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: error: ‘v8::HandleScope::HandleScope()’ is protected
../udev.cc:100:17: error: within this context
../udev.cc:101:36: error: no matching function for call to ‘v8::Array::New()’
../udev.cc:101:36: note: candidate is:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:2417:23: note: static v8::Localv8::Array v8::Array::New(v8::Isolate_, int)
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:2417:23: note: candidate expects 2 arguments, 0 provided
../udev.cc:118:41: error: no matching function for call to ‘v8::Object::New()’
../udev.cc:118:41: note: candidate is:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:2388:24: note: static v8::Localv8::Object v8::Object::New(v8::Isolate_)
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:2388:24: note: candidate expects 1 argument, 0 provided
../udev.cc:120:18: error: ‘NewSymbol’ is not a member of ‘v8::String’
../udev.cc:120:48: error: ‘New’ is not a member of ‘v8::String’
../udev.cc:127:18: error: ‘class v8::HandleScope’ has no member named ‘Close’
../udev.cc: In function ‘void Init(v8::Handlev8::Object)’:
../udev.cc:133:24: error: ‘New’ is not a member of ‘v8::String’
../udev.cc:133:58: error: ‘ThrowException’ was not declared in this scope
../udev.cc:135:17: error: ‘NewSymbol’ is not a member of ‘v8::String’
../udev.cc:136:35: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handlev8::Value (&)(const int&))’
../udev.cc:136:35: note: candidate is:
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:3455:34: note: static v8::Localv8::FunctionTemplate v8::FunctionTemplate::New(v8::Isolate_, v8::FunctionCallback, v8::Handlev8::Value, v8::Handlev8::Signature, int)
/home/pi/.node-gyp/0.12.0/deps/v8/include/v8.h:3455:34: note: no known conversion for argument 1 from ‘v8::Handlev8::Value(const int&)’ to ‘v8::Isolate_’
udev.target.mk:81: recipe for target 'Release/obj.target/udev/udev.o' failed
make: *_* [Release/obj.target/udev/udev.o] Error 1
make: Leaving directory '.../node_modules/node-udev/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Linux 3.12.28+
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd .../node_modules/node-udev
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok

npm ERR! Linux 3.12.28+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the udev package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls udev
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! .../node_modules/node-udev/npm-debug.log

Update NPM package

A checkout of the repository shows version 0.1.5, which compiles and runs in Node 5.4.1, however 0.1.3 is the latest release in NPM.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.