-
Notifications
You must be signed in to change notification settings - Fork 33
How can I make reinstallation of nodes easier
From several recent Google Group discussions...
There shouldn't be anything in the ~/.node-red
tree that is root/root owned. (unless ~
refers to the root user of course!). If this needs fixing, personally, I'd note what nodes I needed to have installed, I'd delete the ~/.node-red/node_modules
folder then reinstall the modules correctly (non-root).
To make reinstallation of Node-RED easier, try creating a package.json file to define all the packages you want installed:
cd ~/.node-red
npm init
And fill in the prompted fields as you like. Note that you cannot use npm init -y
as npm crashes on a name with a leading dot. However, you could use the alternative yarn as yarn init -y
does work.
And then either editing the ~/.node-red/package.json
file to include all the required nodes or by installing them with:
npm install node-red-contrib-xxxxxx --save
Node-RED is expected to create/manage a package.json like this with the built-in package manager from v0.17.
It makes it easy to throw away any/all of the installed packages and reinstall them with a simple:
cd ~/.node-red
npm install
This can be especially useful when Node.JS gets updated.
To get npm to work for you, you may need to edit the package.json
file to change package version numbers to requirements. It is recommended to read the npm information on "semver" ranges.
Having got the version ranges right, you can, from time-to-time, run npm outdated
in the ~/.node-red
folder and you will see which packages have new versions available. Run npm install
or npm update
to get the latest versions compatible with the semver ranges specified in package.json
.
Also note that, where I've used ~/.node-red
in examples above, strictly speaking this might be a different folder if you have not followed the normal installation process. On Windows, ~
is only available if you are using PowerShell or the Ubuntu subsystem, it is not available if using the older CMD shell, in that case, substitute with %USERPROFILE%
.