Not able to see newly created node in UI's Palate

Hello All,

Greetings!!

I am going through link https://nodered.org/docs/creating-nodes/first-node and trying to create my first custom node here. Steps I followed are:

1- Created a new directory named "custom_modules" in my node-red path "/home/ubuntu/.node-red/" to keep my custom nodes there.

2- created html, js files as per tutorial.

3- Then I ran sudo npm init command whose output is as follows:

sudo npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (custom_modules) node-red-contrib-example-lower-case
version: (1.0.0)
description:
entry point: (lower-case.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /home/ubuntu/.node-red/custom_modules/package.json:

{
  "name": "node-red-contrib-example-lower-case",
  "version": "1.0.0",
  "description": "",
  "main": "lower-case.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes) yes

4- Then I ran

sudo npm install /home/ubuntu/.node-red/custom_modules
npm WARN node-red-contrib-example-lower-case@1.0.0 No description
npm WARN node-red-contrib-example-lower-case@1.0.0 No repository field.

up to date in 0.486s

I restarted node-red service but when I go to UI side I can't see my custom node added.
Could you please do guide here, will be grateful.

Thanks,
R. Singh

You don't need sudo to install

Also, you're supposed to put the path to your node - not the destination path.

E.g.

cd ~/.node-red
npm install /src/mynode

Obviously change /src/mynode to your source directory

Edit...
Just noticed your working directory appears to me inside node_modules - that's an odd place to develop. Id suggest moving your src to another place

1 Like

Thank you @Steve-Mcl for helping here. I actually mentioned source path(/home/ubuntu/.node-red/custom_modules) only npm install /home/ubuntu/.node-red/custom_modules is source path where my custom new node's package.json, html and js files are present.

Could you please do let me know if I am doing correctly?

Thanks,
R. Singh

Yeah I misread.

Have you F5 refreshed browser after restarting node red and looked in the side bar for node-red-contrib-example-lower-case ?

Have you checked Dev tools f12 on browser for errors?

Try setting debug level in settings.js to trace & restart again - maybe some clues in node-red startup console/log.

1 Like

Another part, you won’t need to run npm init or any other local npm command as root either. Only global installs of packages would need to run as root. Almost all other npm commands are better run as the local user. Sudo npm init would (likely) result in the package.json file to be created owned by the root user, and thus needing sudo to edit it. If needed, change permissions of all files in the custom_modules folder back to local user/group ownership.

1 Like

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