Node-red custom node disappears after restarts

I've installed custom node using npm install when I restarted the pc, the installed folder which namesd as node-red-custom disappears from the node-modules folder. What's causing this? And also I wasn't able to find a .config file in node-red folder. I think node-red clears out the packages that not defined in that file.

How exactly did you install your custom node?

Is it listed in the package.json file in your Node-RED user directory?

1 Like

Placed the folder inside in the node-modules folder then navigated to the folder and ran the npm install. It is not on the package.json file but I've manually added it now. Now it's working fine. Thanks

Hi, @knolleary Today it is occurring same issue. Package name is on the package.json as well.

How is Node-RED installed? Are you using docker or anything like that?

The better way to install a custom node would be to run the following command inside your .node-red directory:

npm install /full/path/to/your/custom/node

That will ensure the .node-red/package.json file gets updated properly.

Node-RED will not be removing nodes - it doesn't do that. There are only two possible reasons for a node to 'disappear' that I can think of:

  • You are running in docker or something similar, and it is resetting the filesystem back to the default image. But if that were the case, you'd be losing flows as well.
  • The node isn't listed in package.json, and something is running npm install in that directory - npm will remove any module not listed in package.json
1 Like

@knolleary It's on a windows pc. When installing the custom node do I need to point the package.json file or the whole folder.

Use the path to the folder containing package.json

[Edit] Don't put it inside node_modules.

1 Like