cheery / node-udev

Bindings to libudev
35 stars 31 forks source link

Doesn't work with node 8.0.0 #19

Closed mortie closed 4 years ago

mortie commented 7 years ago

The console output from sudo npm install -g udev

> udev@0.4.0 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 udev@0.4.0 and node@8.0.0 (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! udev@0.4.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the udev@0.4.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!     /root/.npm/_logs/2017-06-07T07_23_31_692Z-debug.log
mortie commented 7 years ago

Here's the log file the error is talking about: 2017-06-07T07_23_31_692Z-debug.log.txt

cheery commented 7 years ago

These are the interesting lines. Especially the one about permissions.

node-pre-gyp ERR! Tried to download: https:///node-v57-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for udev@0.4.0 and node@8.0.0 (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"
nbroeking commented 7 years ago

@mortie

This normally happens when trying to do the install offline. This udev module depends on the prebuilt c++ node headers. You need to the build once on the internet or you need pre download the files into the .node-gyp folder. This is an issue with the environment of the machine not with the udev module.

zoutepopcorn commented 6 years ago

@nbroeking or @cheery are you able to install and run on a rPi with node 8.x?

I've got a lot of errors, most the same as above

I had it working before, but I broke my SD card. Can't remember how it worked :(.

cheery commented 6 years ago

@zoutepopcorn I will try this. It's been a while I've popped up rPi and used it for something. I probably use the newest one I have, it's probably rPi 2 or rPi 3. I'll tell how it went later this week.

zoutepopcorn commented 6 years ago

Maybe this did the trick last time

rm -rf ~/.node-gyp

But have to test it later on the pi

cheery commented 6 years ago

@zoutepopcorn I loaded raspbian lite version and tried things out. Here's what I found out.

It would appear that debian renames node to nodejs because Node developers were naive in choosing their executable name on Linux platforms. The installation scripts still try to use the node command, but they find the software that debian calls node. That can cause this to fail, but it would fail earlier. Your script shows that it already gets to build the module.

I skipped the issue by adding a symbolic link node -> /usr/bin/nodejs into a directory, then I exported that directory to a PATH environment variable.

Another thing I did was I installed udev C headers with the following apt command:

sudo apt-get install lib-udev-dev

Then it worked. Though the steps I took didn't reproduce this issue. Unless it's the same problems as here, just manifesting in some illegible manner.

zoutepopcorn commented 6 years ago

Great.

This article pointed me howto install:

https://community.roonlabs.com/t/howto-powermate-extension-on-a-raspberry-pi/23819

You can get your nodejs info to install on the pi using:

cat /proc/cpuinfo

And then download the right one

wget https://nodejs.org/dist/v7.8.0/node-v7.8.0-linux-armv7l.tar.gz

@mortie is this working for you?

jacobq commented 4 years ago

I think this issue can be closed. I just tried compiling it on an RPi 4 running the latest Raspbian (September 2019) with the latest 8.x (8.16.2) and it seems to work fine. Also builds for 10.x though not for 12.x, which is being tracked in #30

cheery commented 4 years ago

You're right. Lets close it.