pi@raspberrypi ~/node-red/node-red-nodes $ sudo npm install serialport
\
> seria...@2.0.6 install /home/pi/node-red/node-red-nodes/node_modules/serialport
> node-pre-gyp install --fallback-to-build
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/node-red/node-red-nodes/node_modules/serialport/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unexpected eof
gyp ERR! stack at decorate (/home/node_modules/npm/node_modules/fstream/lib/abstract.js:67:36)
gyp ERR! stack at Extract.Abstract.error (/home/node_modules/npm/node_modules/fstream/lib/abstract.js:61:12)
gyp ERR! stack at Extract._streamEnd (/home/node_modules/npm/node_modules/tar/lib/extract.js:91:35)
gyp ERR! stack at BlockStream.<anonymous> (/home/node_modules/npm/node_modules/tar/lib/parse.js:51:8)
gyp ERR! stack at BlockStream.emit (events.js:104:17)
gyp ERR! stack at BlockStream._emitChunk (/home/node_modules/npm/node_modules/tar/node_modules/block-stream/block-stream.js:203:10)
gyp ERR! stack at BlockStream.flush (/home/node_modules/npm/node_modules/tar/node_modules/block-stream/block-stream.js:70:8)
gyp ERR! stack at BlockStream.end (/home/node_modules/npm/node_modules/tar/node_modules/block-stream/block-stream.js:66:8)
gyp ERR! stack at Extract.Parse.end (/home/node_modules/npm/node_modules/tar/lib/parse.js:86:23)
gyp ERR! stack at Gunzip.onend (_stream_readable.js:505:10)
gyp ERR! System Linux 4.1.14+
gyp ERR! command "/usr/local/bin/node" "/home/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/node-red/node-red-nodes/node_modules/serialport/build/Release/node-v14-linux-arm/serialport.node" "--module_name=serialport" "--module_path=/home/pi/node-red/node-red-nodes/node_modules/serialport/build/Release/node-v14-linux-arm"
gyp ERR! cwd /home/pi/node-red/node-red-nodes/node_modules/serialport
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /home/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/node-red/node-red-nodes/node_modules/serialport/build/Release/node-v14-linux-arm/serialport.node --module_name=serialport --module_path=/home/pi/node-red/node-red-nodes/node_modules/serialport/build/Release/node-v14-linux-arm' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/node-red/node-red-nodes/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:1015:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
node-pre-gyp ERR! System Linux 4.1.14+
node-pre-gyp ERR! command "node" "/home/pi/node-red/node-red-nodes/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/node-red/node-red-nodes/node_modules/serialport
node-pre-gyp ERR! node -v v0.12.6
node-pre-gyp ERR! node-pre-gyp -v v0.6.18
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /home/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/node-red/node-red-nodes/node_modules/serialport/build/Release/node-v14-linux-arm/serialport.node --module_name=serialport --module_path=/home/pi/node-red/node-red-nodes/node_modules/serialport/build/Release/node-v14-linux-arm' (1)
npm ERR! Linux 4.1.14+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "serialport"
npm ERR! node v0.12.6
npm ERR! npm v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! seria...@2.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the seria...@2.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 their info via:
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/node-red-nodes/npm-debug.log
Any help to solve this issue is accepted.
Thank You so much.
Leonardo
serialport should have installed automatically with node-red... but...
try sudo npm i --unsafe-perm node-red-node-serialport
When trying to build it drop permissions back to "nobody" and it then can't write files it needs to.