Installing The Things Network palette fails without GIT

#1

I have a well established Node-Red implementation running on a Google Cloud Platform machine under Ubuntu 16.04. I recently tried adding The Things Network (node-red-contrib-ttn) whcih failed. After working through on my windows laptop Node-red implementation I discovered that you need GIT installed and ready to run BEFORE you install TTN.
All well and good, but now I cannot uninstall node-red-contrib-ttn from my Ubuntu machine, so I can re-install it.
I get “failed to uninstall ttn” and read the log file to find out why. But Node-Red is a service so no console output to show me why I cannot uninstall. Now what should I do?

thanks
Simon

#2

Found in Syslog the following:

May 30 01:53:31 smbunn-server node-red[1525]: 30 May 01:53:31 - [warn] Uninstall of module node-red-contrib-ttn failed:
May 30 01:53:31 smbunn-server node-red[1525]: 30 May 01:53:31 - [warn] ------------------------------------------
May 30 01:53:31 smbunn-server node-red[1525]: 30 May 01:53:31 - [warn] Error: Command failed: npm remove --save node-red-contrib-ttn
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN checkPermissions Missing write access to /home/smbunn61/.node-red/node_modules/ttn/node_modules/grpc
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN checkPermissions Missing write access to /home/smbunn61/.node-red/node_modules/ttnapi/node_modules/grpc
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN checkPermissions Missing write access to /home/smbunn61/.node-red/node_modules/node-red-contrib-ttn/node_modules/grpc/node_modules
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN checkPermissions Missing write access to /home/smbunn61/.node-red/node_modules/node-red-contrib-ttn/node_modules
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN checkPermissions Missing write access to /home/smbunn61/.node-red/node_modules/joi/node_modules
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN checkPermissions Missing write access to /home/smbunn61/.node-red/node_modules/pumpify/node_modules
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN checkPermissions Missing write access to /home/smbunn61/.node-red/node_modules/topo/node_modules
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN enoent ENOENT: no such file or directory, open '/home/smbunn61/.node-red/node_modules/grpc/package.json'
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN enoent ENOENT: no such file or directory, open '/home/smbunn61/.node-red/node_modules/protobufjs/package.json'
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN enoent ENOENT: no such file or directory, open '/home/smbunn61/.node-red/node_modules/ttn/package.json'
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN enoent ENOENT: no such file or directory, open '/home/smbunn61/.node-red/node_modules/ttnapi/package.json'
May 30 01:53:31 smbunn-server node-red[1525]: npm WARN node-red-project@0.0.1 No repository field.
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! Linux 4.13.0-1015-gcp
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "remove" "--save" "node-red-contrib-ttn"
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! node v4.2.6
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! npm  v3.5.2
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! path /home/smbunn61/.node-red/node_modules/ttn/node_modules/grpc
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! code EACCES
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! errno -13
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! syscall access
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! Error: EACCES: permission denied, access '/home/smbunn61/.node-red/node_modules/ttn/node_modules/grpc'
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR!     at Error (native)
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR!  { [Error: EACCES: permission denied, access '/home/smbunn61/.node-red/node_modules/ttn/node_modules/grpc']
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR!   errno: -13,
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR!   code: 'EACCES',
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR!   syscall: 'access',
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR!   path: '/home/smbunn61/.node-red/node_modules/ttn/node_modules/grpc' }
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR!
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! Please try running this command again as root/Administrator.
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR! Please include the following file with any support request:
May 30 01:53:31 smbunn-server node-red[1525]: npm ERR!     /home/smbunn61/.node-red/npm-debug.log

assume I just need to run chown -R smbunn61 /home/smbunn61/.node-red ?

#3

Yes, that may indicate that you installed a node module using SUDO at some point by mistake.

#4

Also, you are running node v4 which is beyond end of life, so may not work correctly with newer nodes.
The permissions are the main problem, but this may also cause issues very soon.

#5

Using CHOWN completely destroyed my computer, I lost sudo access and being a GCP server I don’t have root access. So I had to delete the virtual machine and start again from scratch. The dangers of CHOWN!

Having now done a clean install of npm (3.5.2) and node (v4.2.6) I cannot install TTN at all as it is failing at grpc. It looks almost like grpc is not installed. I tried a clean install of this using

npm install grpc

but this threw up hundreds of errors

smbunn61@simon-server:~$ npm install grpc

> grpc@1.12.2 install /home/smbunn61/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack TypeError: this is not a typed array.
node-pre-gyp ERR! stack     at Function.from (native)
node-pre-gyp ERR! stack     at Object.<anonymous> (/home/smbunn61/node_modules/grpc/node_modules/tar/lib/parse.js:33:27)
node-pre-gyp ERR! stack     at Module._compile (module.js:410:26)
node-pre-gyp ERR! stack     at Object.Module._extensions..js (module.js:417:10)
node-pre-gyp ERR! stack     at Module.load (module.js:344:32)
node-pre-gyp ERR! stack     at Function.Module._load (module.js:301:12)
node-pre-gyp ERR! stack     at Module.require (module.js:354:17)
node-pre-gyp ERR! stack     at require (internal/module.js:12:17)
node-pre-gyp ERR! stack     at Object.<anonymous> (/home/smbunn61/node_modules/grpc/node_modules/tar/lib/list.js:10:16)
node-pre-gyp ERR! stack     at Module._compile (module.js:410:26)
node-pre-gyp ERR! System Linux 4.13.0-1017-gcp
node-pre-gyp ERR! command "/usr/bin/nodejs" "/home/smbunn61/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"

So I have just about given up. Can the TTN palette be installed?

#6

As Dave has already mentioned Node v4 is end-of-life

But you really shouldn’t have as many issues as your are experiencing. Have you opened an issue on the github page for the node ( see the nodes page on flows.nodered.org for a link )

#7

That was it! The main website that talks about installing Node-Red on Ubuntu is digital ocean.

This promotes using legacy node as it keeps things unbroken.

#8

If you are installing on vanilla Ubuntu then you can actually use the install script from our Pi install instructions, as that is also Debian based like Ubuntu. Just run it as the user you want to run Node-RED as and it should install both node.js and Node-RED for you to get you a working Node-RED… what you do to break it after that is up t you :slight_smile: