Hello guys, I'm trying to create my first node in Node-RED, but I haven't been successful so far.
I'm using the lower-case example from Node-RED.
The steps I'm following are the following:
1.-create folder in directory .node-red/node-modules/
2.-I'm creating the files package.json, lowercase.json, and lowercase.html.(In the package.json file, I'm defining the location of lowercase.json)
3.- Restart node-red
These steps haven't worked for me, what can I do? Could you help me with an example or point out where I'm going wrong or skipping?
Node-RED is a node.js app. So you should generally follow the development process for a node.js module, that is then packaged via npmjs.org and so available to Node-RED.
To develop, the best workflow is to create a new GitHub repository. Clone it to your local development machine. Go into the folder you cloned to and do npm init -y to give yourself a package.json file.
Then you should be able to install the module into node-red simply by switching to your userDir folder (e.g. ~/.node-red/) and doing npm install /path/to/my/clone/folder.
Finally restart node-red.
To make changes to the code, all you then have to do is save the file and restart node-red. For changes to the html file, you will also have to reload the Editor page.
You can use something like PM2 to run node red on your dev device and configure it with a watch config so that node-red restarts when an appropriate file changes. That saves some effort.
To use the lowercase node as an example, do the same but copy in the 3 files before restarting Node-RED. Or copy them into your original GitHub repo before cloning.
@TotallyInformation ... I also am in the process of writing my own node and have one question on the setup. I read on one of the NR doc pages that we should exclude the "node-red" section on the package.json file until we are ready to release it to the public. Could you provide some clarity on if that is true or not?
Not the node-red section, don't add a "node-red" keyword. That means that if you publish it, it won't appear in the node-red palette manager or the flows site until you are ready for it to be publicly usable. You can still get people to test it by installing from the command line.