If I install nodejs on a new linux debian machine - nodejs states that the official recommended way is to use nvm (among other options).
The node-red install script states that nvm is not supported, this sounds like a conflict ?
How can i use the install script (i like to have nr as service options).
I thought that the official builds for debian were ceasing. When I looked recently 22 was not there. On my phone for the next few days so not so easy to check.
Node.js themselves have not built Debian installers for a long time. Those are built by Nodesource.
It looks like they have just changed the way they do things:
Package Changes: DEB and RPM packages are now available under the nodistro codename. We no longer package the installer coupled to specific versions. This means you can install Node.js on almost any distro that meets the minimum requirements.
Installation Scripts: Back by popular demand, the installation scripts have returned and are better than ever. See the installation instructions below for details on how to use them.
The reason most of us don't recommend using nvm or similar is that every time you change node.js version, you have to also install all the global packages that go with it. This is, at best, very confusing. To say that Node-RED doesn't support nvm isn't really accurate, it absolutely works fine - as long as you remember to install Node-RED again when you change versions.
This is a very wasteful approach and even more confusing if you forget to remove old versions since this can tie up a LOT of storage unwittingly.
So unless you have a specific reason to want to run multiple Node.js versions on the same device, it generally seems simpler to avoid all the pitfalls.
You should note that the main driver for Node.js pushing nvm would seem to be following Python's similar approach in pushing the use of "environments" which does the same thing.
nvm installs also only work for a single user on a given computer and ONLY when they have a login session.
While most linux machines are "single" user these days, rather than the shared multi user resources they used to be, it does make life more difficult
This means that without some extra messing about you can not use the nvm install of NodeJS to run Node-RED as a service.
And while it is a BAD idea to run Node-RED as root (unless you 110% know what you are doing and there are usually better ways) there can be times it's needed and NVM would mean having to install NodeJS twice, once for each user.