httpStatic and image

Trying to store some images on the PI and then show the images using the html template.

There was some mention of setting the 'httpStatic' to point to where the files will be stored.
But I am having bit of problem of locating the settings.js file that was mentioned.
Here is screen shot . Can not see any settings.js file.

settings

1 Like

If you start node-red from the command line it will tell you which settings.js it is using and the path to it.

Hi UKMoose,
Thank you.
On the Command Line, I ran :
node-red-stop ( to stopped Node Red because Node Red was running already)
node-red-start
Then I saw the path to the path to the settings.js

I am sure this will be handy for others.

1 Like

Where is it? It should be in .node-red

Hi Uk Moose,
I changed the httpStatic to : httpStatic: ' home/pi/personal/ ',
Put the image in the home/pi/personal directory

Inserted a html template with the following but the image is not pulling up.
Any ideas?

No need to address your query to one person, as there's lots of people here who can give advice.

Your image didn't make it ..

And as Colin said, if you had already run Node-RED it should have been where you were looking. so where was it?

Aside from the precise location of the settings file, which is important to confirm, when you say:

httpStatic: ' home/pi/personal/ ',

did you mean: '/home/pi/personal/' - the slash at the front is quite important.

Also, you need to restart Node-RED whenever you edit the settings file.

1 Like

Hi Nick and rest of team.
0. The location of the settings.js file was:
/usr/lib/node_modules/node-red/settings.js

I manuevered to that location and did a sudo nano settings.js

  1. Attached is image of the settings.js file
    Note: changed it to '/home/pi/sweetwater/',
    Then typed in ctrl + o then ctrl + x

  2. Then created a html template node . But the .jpg file does not show.

sweetwater pic

Back to some basic questions

  1. What version of NR and node.js are you running? You can get them from the node-red log when you start node-red manually using node-red-start
  2. How did you install node-red on the Pi?
  3. have you ever run the bash script located here: https://nodered.org/docs/hardware/raspberrypi
    If not, I suggest you backup your flows_raspberrypi.json and flows_raspberrypi_cred.json files and then run the script. Then see if the settings.js is in the .node-red folder.
  1. You should probably remove the /home/nol etc line

  2. never use sudo unless you actually need to.

  3. As Nick said you need to restart Node-RED after changing the settings file. When Node-RED restarts check it is still picking up the same settings.js file

  4. What have you typed into the html template?

1.running node red V0.18.4
2.running PI Raspian. Installed from the 'NOOB' which included the Node Red.
3. the /home/nol line ( that was commented out //)

Run the bash <(curl script in the raspbian install instructions [1]. That should give you an up to date node red environment with everything in the right place.

[1] https://nodered.org/docs/hardware/raspberrypi

The settings.js in the /usr dir is the template one that gets copied over to your user directory on first run. You should only edit the one in your users directory (typically /home/pi/.node-red on a pi etc)

Ceejay if you read the thread, it wasn’t copied over and Node-RED was picking up the other one.

And aren’t you supposed to be on vacation?

In the very early days of Node-RED, before we had the concept of a user data directory, you would edit the settings file in the install directory of Node-RED.

We then added the user data directory to keep things separate. However we needed to not break existing users - so the code checks the modified timestamp of the settings file in the install directory. If that has been edited, and one doesn't exist in the user directory, we'll use the one in the install directory rather than copy over to the user directory.

So it is possible to get into this state.