How to update function modules?

A Function node is currently using an old version of a package I added under "Setup". How do I get it to update?

I tried:

  • Deleting the module from the Setup tab an re-adding it.
  • Deleting the module from the node_modules directory in the project directory.
  • Deleting package-lock.json from the project directory.
  • Deleting .package-lock.json from the node_modules directory

Now it's gone - I deleted it - but Node-RED won't install the latest version.

It is very rarely a good idea to mess with npm's files. I would have expected the package to appear in Manage Palette and allow you to update it there.

To recover the situation go into your .node-red folder (assuming it is a conventional install) and run
npm remove the_package
npm install the_package
If there are any errors there then come back here. Otherwise restart node-red and it should be ok.

@AndreKR Did you get this sorted?

They don't:

Eventually yes. I deleted the whole node_modules directory, restarted Node-RED and then installed an arbitrary new palette package, this finally brought Node-RED to reinstall all the packages.

Did you try what I suggested first? If so what was the result?

I didn't, for two reasons:

  • By the time I read it, I had already recreated the node_modules directory.
  • Running npm install manually in the Node-RED project directory writes files, which might mess up permissions, so that's something I want to leave entirely to the Node-RED process inside the container. Deleting files on the other hand is fine.

You had not mentioned that you are running in a container. That can complicate matters certainly.

Well, of course I am, but even with a host installation from a .deb I would have to watch the permissions, so container or not doesn't really make a difference here.

I believe that the majority of users running node red do not use containers. They generally don't install node-red from a .deb either.

Provided that you are logged in as the user that runs node red then there won't be an issue with file permissions running npm manually. Unless you have a very unusual setup.

You are right. I have opened a Feature Request for this.