Node-red as a snap not able to run git

Hi!

I'm using node-red as a snap and I'm finding some troubles installing some nodes from the Palette Manager.

The problem in this case is that node-red is not able to run 'git' (which is located in the host system outside the snap).

I know that this is a snap issue, but I was wondering if somebody has found the same problem and has some kind of workaround.

This is the log I get:

2022-11-21T08:41:09.846Z Install : @arduino/node-red-contrib-arduino-iot-cloud 1.0.7

2022-11-21T08:41:09.917Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict @arduino/node-red-contrib-arduino-iot-cloud@1.0.7
2022-11-21T08:41:11.849Z [err] npm
2022-11-21T08:41:11.852Z [err]  
2022-11-21T08:41:11.853Z [err] WARN
2022-11-21T08:41:11.853Z [err]  
2022-11-21T08:41:11.854Z [err] config
2022-11-21T08:41:11.855Z [err]  production Use `--omit=dev` instead.
2022-11-21T08:41:33.580Z [err] npm
2022-11-21T08:41:33.585Z [err]  
2022-11-21T08:41:33.585Z [err] ERR!
2022-11-21T08:41:33.586Z [err]  
2022-11-21T08:41:33.586Z [err] code
2022-11-21T08:41:33.587Z [err]  ENOENT
2022-11-21T08:41:33.588Z [err] npm
2022-11-21T08:41:33.589Z [err]  
2022-11-21T08:41:33.590Z [err] ERR!
2022-11-21T08:41:33.596Z [err]  
2022-11-21T08:41:33.597Z [err] syscall
2022-11-21T08:41:33.597Z [err]  spawn git
2022-11-21T08:41:33.598Z [err] npm
2022-11-21T08:41:33.599Z [err]  
2022-11-21T08:41:33.599Z [err] ERR!
2022-11-21T08:41:33.600Z [err]  
2022-11-21T08:41:33.600Z [err] path
2022-11-21T08:41:33.604Z [err]  git
2022-11-21T08:41:33.604Z [err] npm ERR! errno -2
2022-11-21T08:41:33.615Z [err] npm
2022-11-21T08:41:33.615Z [err]  
2022-11-21T08:41:33.616Z [err] ERR!
2022-11-21T08:41:33.616Z [err]  
2022-11-21T08:41:33.617Z [err] enoent
2022-11-21T08:41:33.618Z [err]  An unknown git error occurred
2022-11-21T08:41:33.618Z [err] npm
2022-11-21T08:41:33.619Z [err]  
2022-11-21T08:41:33.619Z [err] ERR!
2022-11-21T08:41:33.620Z [err]  
2022-11-21T08:41:33.625Z [err] enoent This is related to npm not being able to find a file.
2022-11-21T08:41:33.625Z [err] npm ERR! enoent 
2022-11-21T08:41:33.628Z [err] 
2022-11-21T08:41:33.630Z [err] npm
2022-11-21T08:41:33.630Z [err]  
2022-11-21T08:41:33.632Z [err] ERR!
2022-11-21T08:41:33.635Z [err]  A complete log of this run can be found in:
2022-11-21T08:41:33.635Z [err] npm ERR!     /root/snap/node-red/838/.npm/_logs/2022-11-21T08_41_11_657Z-debug-0.log
2022-11-21T08:41:33.659Z rc=254

Thanks!

Are you on a Debian based system? If so then I suggest installing using the recommended install script rather than the snap package. That works with Debian/Ubuntu/PiOS for example.

Thanks for the answer.

Yep, I'm on a Debian-based system (Ubuntu). I know that I can use the standard installation, but I always prefer having this kind of applications running on isolated sandboxes. I usually install node-red with Docker, but this machine has very little memory and storage, so it's quite a stretch. That's why I wanted to use snap instead.

If there is not any kind of workaround or fix using snap, I will definitely use the standard installation script.

The simplest fix would be to include git along with the snap, but that's something that has to be done by the creators of the snap. I tried to find the location of the snap installation on github to suggest that change but I couldn't find it.

And I think that you have partially answered your own question haven't you? The snap needs to be able to access other resources in order for npm, node.js and node-red to work. I've never used snap so I don't know how to do that but I know that snap is a form of application virtualisation so each snap needs to be configured to give access to appropriate OS resources.

The snap project is here - GitHub - dceejay/nodered.snap: Node RED snappy package - but as per the readme git and gcc etc are specificaly not included. But feel free to clone and add it yourself if you want to.