maxwellhadley / node-red-contrib-rfxcom

node-RED nodes to access an RFXtrx433 transceiver
BSD 2-Clause "Simplified" License
22 stars 13 forks source link

problems - can not install node-red-contrib-rfxcom #57

Closed lpt2007 closed 6 years ago

lpt2007 commented 6 years ago

After upgrade of node-red module stop working.

Errors: [INFO] Disabling SSL [INFO] Updating IDE Users [INFO] Adding IDE User admin [INFO] Updating HTTP Node User [INFO] Adding HTTP Node User admin [INFO] Disabling Projects [INFO] Attempting to install/update nodes: node-red-contrib-home-assistant node-red-contrib-rfxcom npm info lifecycle undefined~preshrinkwrap: undefined npm info lifecycle undefined~shrinkwrap: undefined npm info lifecycle undefined~postshrinkwrap: undefined npm WARN node-red-project@0.0.1 No repository field. npm WARN node-red-project@0.0.1 No license field. npm info ok npm info it worked if it ends with ok npm info using npm@5.0.3 npm info using node@v8.1.3 npm info lifecycle node-red-docker@1.0.0~prestart: node-red-docker@1.0.0 npm info lifecycle node-red-docker@1.0.0~start: node-red-docker@1.0.0

node-red-docker@1.0.0 start /usr/src/node-red node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/share/node-red" 24 Jun 01:36:13 - [info] Welcome to Node-RED

24 Jun 01:36:13 - [info] Node-RED version: v0.18.7 24 Jun 01:36:13 - [info] Node.js version: v8.1.3 24 Jun 01:36:13 - [info] Linux 4.4.50 arm LE 24 Jun 01:36:14 - [info] Loading palette nodes 24 Jun 01:36:19 - [warn] ------------------------------------------------------ 24 Jun 01:36:19 - [warn] [node-red-contrib-rfxcom/rfxcom] Error: The module '/share/node-red/node_modules/serialport/build/Release/serialport.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 59. This version of Node.js requires NODE_MODULE_VERSION 57. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install). 24 Jun 01:36:19 - [warn] ------------------------------------------------------ 24 Jun 01:36:19 - [info] Settings file : /share/node-red/settings.js 24 Jun 01:36:19 - [info] User directory : /share/node-red 24 Jun 01:36:19 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable 24 Jun 01:36:19 - [info] Flows file : /share/node-red/flows.json 24 Jun 01:36:19 - [info] Server now running at http://127.0.0.1:1880/ 24 Jun 01:36:19 - [warn]

Your flow credentials file is encrypted using a system-generated key. If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials. You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

24 Jun 01:36:19 - [info] Waiting for missing types to be registered: 24 Jun 01:36:19 - [info] - rfxtrx-port 24 Jun 01:36:19 - [info] - PT2262-device-list 24 Jun 01:36:19 - [info] - rfx-PT2262-in 24 Jun 01:36:19 - [info] - rfx-lights-in 24 Jun 01:36:19 - [info] - rfx-lights-out

then I uninstaled module and try to install again and I get Error: npm ERR! path /share/node-red/node_modules/node-red-contrib-rfxcom/node_modules/.bin/find-rfxcom npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall chmod npm ERR! enoent ENOENT: no such file or directory, chmod '/share/node-red/node_modules/node-red-contrib-rfxcom/node_modules/.bin/find-rfxcom' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-06-24T00_29_50_544Z-debug.log

maxwellhadley commented 6 years ago

I'm not sure what has happened here, but it looks like a problem with installing the node-rfxcom package that node-red-contrib-rfxcom uses. I have come across something similar, but as I have never tried using Docker, I can't guarantee the following, but try it out:

cd to /share/node-red/node_modules/node-red-contrib-rfxcom/node_modules/ this should have just one directory 'rfxcom' (though there may be an npm debug log as well).

rm -rf the rfxcom directory and all its contents

cd to .. (i.e. /share/node-red/node_modules/node-red-contrib-rfxcom) and run npm install

This should force node-rfxcom and its dependencies - including the serialport package that raised the initial error - to be reinstalled from scratch. If it succeeds, this installation should get node-red-contrib-rfxcom going again.

There is still an error because the .bin/ directory with the links to the rfxcom scripts is not present. I don't know what has happened here - I thought I had fixed this but it seems to have broken again. However, you can ignore this unless you desperately want to run find-rfxcom or set-protocols from the node-red-contrib-rfxcom package directory. They should run from the rfxcom package directory OK (/share/node-red/node_modules/node-red-contrib-rfxcom/node_modules/rfxcom)

lpt2007 commented 6 years ago

Hi

I am using node-red as addon run trough docker on home assistant and I don't know how ssh to container and run this commands? I will try this If I find the way ssh to docker container.

lpt2007 commented 6 years ago

Hi Again,

I installed node-red from scratch and try to install node-red-contrib-rfxcom but still not working. Is there is a problem with ARM version(raspberry pi 3), besause I try to install it on x64(PC) and is working?

maxwellhadley commented 6 years ago

There was a major change in serialport (which node-rfxcom depends on) between versions 4 and 5: for this reason I am restricting the version of serialport to 4.x.x. There are known problems with serialport 4.x.x on ARM, but I have only heard of these so far with NodeJS version 10+. I am currently trying to address these, but there are big problems on MacOS which are proving very difficult to pin down. I'm working on it when I can spare the time!

lpt2007 commented 6 years ago

Hi

It look like there is a problem with serialport 4.x.x.

There is a log: 15:49:21 - [info] Installing module: node-red-contrib-rfxcom, version: 2.6.1 25 Jun 15:50:01 - [warn] Installation of module node-red-contrib-rfxcom failed: 25 Jun 15:50:01 - [warn] ------------------------------------------ 25 Jun 15:50:01 - [warn]

serialport@4.0.7 install /config/node-red/node_modules/serialport node-pre-gyp install --fallback-to-build node-pre-gyp info it worked if it ends with ok node-pre-gyp verb cli [ '/usr/bin/node', node-pre-gyp verb cli '/config/node-red/node_modules/serialport/node_modules/.bin/node-pre-gyp', node-pre-gyp verb cli 'install', node-pre-gyp verb cli '--fallback-to-build' ] node-pre-gyp info using node-pre-gyp@0.6.32 node-pre-gyp info using node@8.9.3 | linux | arm node-pre-gyp verb command install [] node-pre-gyp info check checked for "/config/node-red/node_modules/serialport/build/Release/serialport.node" (not found) node-pre-gyp http GET https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v57-linux-arm.tar.gz node-pre-gyp http 404 https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v57-linux-arm.tar.gz node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v57-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.7 and node@8.9.3 (node-v57 ABI) (falling back to source compile with node-gyp) node-pre-gyp http 404 status code downloading tarball https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v57-linux-arm.tar.gz node-pre-gyp verb command build [ 'rebuild' ] gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19) gyp ERR! stack at PythonFinder. (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16) gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:16) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16 gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5 gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21) gyp ERR! System Linux 4.4.50 gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/config/node-red/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/config/node-red/node_modules/serialport/build/Release" gyp ERR! cwd /config/node-red/node_modules/serialport gyp ERR! node -v v8.9.3 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 '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/config/node-red/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/config/node-red/node_modules/serialport/build/Release' (1) node-pre-gyp ERR! stack at ChildProcess. (/config/node-red/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:126:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) node-pre-gyp ERR! System Linux 4.4.50 node-pre-gyp ERR! command "/usr/bin/node" "/config/node-red/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /config/node-red/node_modules/serialport node-pre-gyp ERR! node -v v8.9.3 node-pre-gyp ERR! node-pre-gyp -v v0.6.32 node-pre-gyp ERR! not ok Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/config/node-red/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/config/node-red/node_modules/serialport/build/Release' (1) npm WARN node-red-project@0.0.1 No repository field. npm WARN node-red-project@0.0.1 No license field. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! serialport@4.0.7 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the serialport@4.0.7 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/2018-06-25T13_50_01_896Z-debug.log

maxwellhadley commented 6 years ago

There are no prebuilt serialport binaries available for ARM, so it is trying to compile from source. It does this using gyp, which requires Python 2 to be installed, as well as the C/C++ compiler. Some or all of these are missing. This is mentioned in the Node-RED installation instructions, at https://nodered.org/docs/hardware/raspberrypi

On really minimal Debian installs you may want to sudo apt-get install build-essential before running the script so that the serialport builds and installs OK. This is optional.

lpt2007 commented 6 years ago

I installed Python and C/C++ compiler: Still not working.

Error: /root/.node-gyp/8.9.3/include/node/v8.h:9743:14: note: declared here Local Value::ToInt32() const { ^~~~~ ../src/serialport.cpp: In function 'void EIO_AfterFlush(uv_work_t)': ../src/serialport.cpp:516:30: warning: 'v8::Local Nan::Callback::Call(int, v8::Local) const' is deprecated [-Wdeprecated-declarations] data->callback.Call(2, argv); ^ In file included from ../src/./serialport.h:7:0, from ../src/serialport.cpp:1: ../../nan/nan.h:1618:3: note: declared here Call(int argc, v8::Local argv[]) const { ^~~~ ../src/serialport.cpp: In function 'Nan::NAN_METHOD_RETURN_TYPE Set(Nan::NAN_METHOD_ARGS_TYPE)': ../src/serialport.cpp:528:29: warning: 'v8::Local v8::Value::ToInt32() const' is deprecated: Use maybe version [-Wdeprecated-declarations] int fd = info[0]->ToInt32()->Int32Value(); ^ In file included from /root/.node-gyp/8.9.3/include/node/node.h:63:0, from ../../nan/nan.h:51, from ../src/./serialport.h:7, from ../src/serialport.cpp:1: /root/.node-gyp/8.9.3/include/node/v8.h:9743:14: note: declared here Local Value::ToInt32() const { ^~~~~ ../src/serialport.cpp: In function 'void EIO_AfterSet(uv_work_t)': ../src/serialport.cpp:573:30: warning: 'v8::Local Nan::Callback::Call(int, v8::Local) const' is deprecated [-Wdeprecated-declarations] data->callback.Call(1, argv); ^ In file included from ../src/./serialport.h:7:0, from ../src/serialport.cpp:1: ../../nan/nan.h:1618:3: note: declared here Call(int argc, v8::Local argv[]) const { ^~~~ ../src/serialport.cpp: In function 'Nan::NAN_METHOD_RETURN_TYPE Drain(Nan::NAN_METHOD_ARGS_TYPE)': ../src/serialport.cpp:585:29: warning: 'v8::Local v8::Value::ToInt32() const' is deprecated: Use maybe version [-Wdeprecated-declarations] int fd = info[0]->ToInt32()->Int32Value(); ^ In file included from /root/.node-gyp/8.9.3/include/node/node.h:63:0, from ../../nan/nan.h:51, from ../src/./serialport.h:7, from ../src/serialport.cpp:1: /root/.node-gyp/8.9.3/include/node/v8.h:9743:14: note: declared here Local Value::ToInt32() const { ^~~~~ ../src/serialport.cpp: In function 'void EIO_AfterDrain(uv_work_t)': ../src/serialport.cpp:617:30: warning: 'v8::Local Nan::Callback::Call(int, v8::Local) const' is deprecated [-Wdeprecated-declarations] data->callback.Call(1, argv); ^ In file included from ../src/./serialport.h:7:0, from ../src/serialport.cpp:1: ../../nan/nan.h:1618:3: note: declared here Call(int argc, v8::Local argv[]) const { ^~~~ CXX(target) Release/obj.target/serialport/src/serialport_unix.o ../src/serialport_unix.cpp:32:26: fatal error: linux/serial.h: No such file or directory

include <linux/serial.h>

                      ^

compilation terminated. make: *** [serialport.target.mk:95: Release/obj.target/serialport/src/serialport_unix.o] Error 1 make: Leaving directory '/config/node-red/node_modules/serialport/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/npm/node_modules/node-gyp/lib/build.js:258:23) gyp ERR! stack at emitTwo (events.js:126:13) gyp ERR! stack at ChildProcess.emit (events.js:214:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) gyp ERR! System Linux 4.4.50 gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/config/node-red/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/config/node-red/node_modules/serialport/build/Release" gyp ERR! cwd /config/node-red/node_modules/serialport gyp ERR! node -v v8.9.3 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 '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/config/node-red/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/config/node-red/node_modules/serialport/build/Release' (1) node-pre-gyp ERR! stack at ChildProcess. (/config/node-red/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:126:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) node-pre-gyp ERR! System Linux 4.4.50 node-pre-gyp ERR! command "/usr/bin/node" "/config/node-red/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /config/node-red/node_modules/serialport node-pre-gyp ERR! node -v v8.9.3 node-pre-gyp ERR! node-pre-gyp -v v0.6.32 node-pre-gyp ERR! not ok Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/config/node-red/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/config/node-red/node_modules/serialport/build/Release' (1) npm WARN node-red-project@0.0.1 No repository field. npm WARN node-red-project@0.0.1 No license field. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! serialport@4.0.7 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR!

maxwellhadley commented 6 years ago

Sigh...

The underlying error looks like:

`CXX(target) Release/obj.target/serialport/src/serialport_unix.o ../src/serialport_unix.cpp:32:26: fatal error: linux/serial.h: No such file or directory

include <linux/serial.h>`

A header file seems to be missing. You would think it would be included in build-essentials, but apparently not. I don't know which package might provide it, I'm afraid.

lpt2007 commented 6 years ago

Thank a lot I find missing file: https://pkgs.alpinelinux.org/contents?file=serial.h&path=*&name=linux-headers&branch=edge&repo=main&arch=armhf

Now is working :)

How to solve problem on alpine linux:

apk add alpine-sdk apk add python apk add linux-headers

Now you can install node-red-contrib-rfxcom.

Problem solved:)

maxwellhadley commented 6 years ago

Yipee!!