Updating dependency of an installed node

Hello, is there a way to change only the dependency of one package without fork, reinstall, reconfigure the complete node?

Reason: "failed to load routines: "no body"" · Issue #191 · 586837r/node-red-contrib-alexa-remote2 · GitHub

I have try to mag this change in the package.json in the installed package and run npm outdated on this packed but it not seams to work.

The way in the issue change the node name and so on, and I must reconfigure all my flows, not a easy way, I think.

Thanks, Alex

Why don't you want to fork it? If you do that, edit package.json and then in your .node-red folder run
npm install yourgitid/node-red-contrib-alexa-remote2
and restart node red you are all done.

The alternative without forking is to clone the repository to the node red server machine, edit package.json and then, from .node-red folder
npm install path/to/clone/node-red-contrib-alexa-remote2

The advantage of a fork is that it will stay there and you don't need to remember to do it again if you have to rebuild your system.

1 Like

Hi @Colin , thank you for the quick answer.

About the first solution: will the npm install of my fork overwrite the original installation and if so, what about updates? And how did I go back to the original version, if the owner make the required update of dependency for his project?

Sorry for this questions, I only use the Palette Manager right now. And my installation is in a docker if this info helpful.

Thanks, Alex

I don't know much about docker, but the only difference should be, I think, that you will need to go to a terminal in the docker container to run npm.


Updates to the original version won't do anything. If you update the fork then run the npm install yourgitid/... again.

To get back to the original version
npm remove node-red-contrib-alexa-remote2
npm install node-red-contrib-alexa-remote2

No problem, npm is not the most intuitive of tools.

1 Like

One last question:

If I do the remove command, will node-red delete the nodes and the config? Or should I do all the commands while node-red is stopped? But in Docker I can only stop node-red by stopping the container and then a can‘t attached to the shell in the container to run npm.
Or is the remove/install not a problem with a running node-red instance?

Thanks, Alex

It is not a problem to run npm while node-red is running. npm manipulates the files in your .node-red/node_modules folder, and package.json and package-lock.json. All of those are read when node-red is started and the nodes in node_modules are loaded, but are not referenced again, unless you use the package manager, which runs npm behind the scenes. So provided you do not run the package manager at the same time as running npm in a terminal then you should not have a problem. I do it all the time.

[Edit] Also the fact that you have temporarily removed the node will not affect your flows, they are in your flows file which npm does not touch.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.