SNAP run npm command

#1

Hello,
I installed node-red as a snap on ubuntu-core. It's an easy process and everything is working nicely except that I am not able to run npm command to manually install node.

For example automatic installation from browser of node-red-contrib-modbus is failing so I would like to use the recommended command :
npm install node-red-contrib-modbus --unsafe-perm --build-from-source

or if want to use" npm install" to automatically install all the node listed in packages.json.

This is more a problem related to snap than to node-red but if any of you have an idea...

Thanks

Martin

0 Likes

#2

The strict containerisation of snap means that although node and npm are installed inside the snap they aren't available outside... Also all the extra build tools to compile a node with binary options do not remain inside....

So the best way round is to build your own snap based off the master - https://github.com/dceejay/nodered.snap

and edit the snapcraft.yaml file to add the extra nodes you want at build time - so it is packaged how you want it.

0 Likes

#3

Thank you for the answer, if build my own snap it will no more update node-red automatically?

0 Likes