tyrrellsystems / node-red-contrib-serial-modbus

This node is now maintained from @leifnel's fork
https://github.com/leifnel/node-red-contrib-serial-modbus
Apache License 2.0
7 stars 13 forks source link

Cannot install package #12

Closed nygma2004 closed 7 years ago

nygma2004 commented 7 years ago

Sorry if I am being to obvious, but I am relatively new to node-red and also beginner in Linux as well. I am trying to add your module to my node-red in Rpi.

I run sudo npm install node-red-contrib-serial-modbus and I get the following error already in the beginning: node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.5/serialport-v4.0.5-node-v11-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.5 and node@0.10.29 (node-v11 ABI) (falling back to source compile with node-gyp)

Is this supposed to happen like this?

Make fails later with the following error: 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:276:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)

Thanks in advanced. Csongor

hardillb commented 7 years ago

I saw something similar today while installing on a very similar system to a rPi. The error comes from the serialport package which is a co-dependency of of the modbus-serial node that this node-red node is built on. I didn't look too closely at it because I was doing something else at the time, but it might be because node 0.10.x that ships on the pi is no longer supported so nodes are starting to drop support for it. If so this will be a problem.

I'll have a proper look at the error tomorrow and see if there is a fix/workaround

nygma2004 commented 7 years ago

Thanks a lot. Keep me posted.

hardillb commented 7 years ago

I've just done an install on my pi and it finished properly. It did show some warnings and some node-pre-gyp errors but these were just because pre-build binaries were not available so it built the binary from src.

$ npm install node-red-contrib-serial-modbus
/
> serialport@4.0.5 install /home/pi/node-red-0.15.1/node_modules/node-red-contrib-serial-modbus/node_modules/serialport
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.5/serialport-v4.0.5-node-v46-linux-arm.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.5 and node@4.4.4 (node-v46 ABI) (falling back to source compile with node-gyp) 
make: Entering directory '/home/pi/node-red-0.15.1/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build'
  CXX(target) Release/obj.target/serialport/src/serialport.o
  CXX(target) Release/obj.target/serialport/src/serialport_unix.o
  CXX(target) Release/obj.target/serialport/src/serialport_poller.o
  SOLINK_MODULE(target) Release/obj.target/serialport.node
  COPY Release/serialport.node
make: Leaving directory '/home/pi/node-red-0.15.1/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build'
npm WARN unmet dependency /home/pi/node-red-0.15.1/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/node_modules/node-pre-gyp/node_modules/tar-pack requires debug@'~2.2.0' but will load
npm WARN unmet dependency /home/pi/node-red-0.15.1/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/node_modules/debug,
npm WARN unmet dependency which is version 2.3.2
node-red-contrib-serial-modbus@0.0.8 node_modules/node-red-contrib-serial-modbus
├── modbus-serial@4.5.1
├── bluebird@3.4.6
└── serialport@4.0.5 (bindings@1.2.1, commander@2.9.0, lie@3.1.0, debug@2.3.2, nan@2.4.0, object.assign@4.0.4)
hardillb commented 7 years ago

@nygma2004 can I close this?

nygma2004 commented 7 years ago

@hardillb I am sorry, I missed the above post. Let me test it myself in the evening. Since it is working for you, I presume it will be an issue with my setup. I will come back to you in the evening. I would not like to keep the issue open too long.

nygma2004 commented 7 years ago

@hardillb I tested again and this is the entire output from npm:

root@OpenHAB:/home/pi/.node-red# npm install node-red-contrib-serial-modbus
|
> serialport@4.0.6 install /home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.6/serialport-v4.0.6-node-v11-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.6 and node@0.10.29 (node-v11 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/0.10.29"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/.node-gyp"
make: Entering directory '/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build'
make: *** No rule to make target '../.node-gyp/0.10.29/common.gypi', needed by 'Makefile'.  Stop.
make: Leaving directory '/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/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/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.4.13-v7+
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build/Release"
gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport
gyp ERR! node -v v0.10.29
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 'node-gyp build --fallback-to-build --module=/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build/Release' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:755:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:822:5)
node-pre-gyp ERR! System Linux 4.4.13-v7+
node-pre-gyp ERR! command "node" "/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport
node-pre-gyp ERR! node -v v0.10.29
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp build --fallback-to-build --module=/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/pi/.node-red/node_modules/node-red-contrib-serial-modbus/node_modules/serialport/build/Release' (1)
npm ERR! Linux 4.4.13-v7+
npm ERR! argv "node" "/usr/local/bin/npm" "install" "node-red-contrib-serial-modbus"
npm ERR! node v0.10.29
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE

npm ERR! serialport@4.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@4.0.6 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs serialport
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/.node-red/npm-debug.log
root@OpenHAB:/home/pi/.node-red#
hardillb commented 7 years ago

OK, looks like your environment has some problems. Couple of questions

  1. Why are you using root to install node modules for the pi user?
  2. Why doesn't root have access to write to it's own home directory?

Either way this is not a problem with the node-red-contrib-serial-modbus node, you need to raise this with the serialport guys, but I think this is going to be some problem with your install, possibly a corrupt SD card.

hardillb commented 7 years ago

As you are trying to install as root try add --unsafe-perm to the npm install command

nygma2004 commented 7 years ago

Thanks a lot, that was the trick. I am receiving data already.