i added a image in template node
but image is not showing.i write this code on template editor.
Do you mean an image ,bmp .jpg .or a web page .html ?
image in jpg format
In settings.js there is a setting for httpStatic, you need to set this path to a location where you want to serve your images from. Then restart NR.
eg create a folder in your NR directory called images and set the path to './images'
then use
<img src="filename">
I created the Folder.and given the path but my NR is stopped after path is defined please check am i make changes on correct location.
No, not correct, you have two paths defined, you should only have one (what I know)
Besides that, I use also a slash in front of my image names
Like
img src="/captured31.jpg"
When i make changes on httpstatic and define path node-red not able to start.when i launch from cmd it generate error.
Backslashes need to be escaped with another backslash. E.g. c:\\users\\xxx\\...
Better yet, use regular slashes. E.g. c:/users/xxx/...
Lastly, remove the nol/
example.
Also, in your screenshot, you have 2 httpStatic:
entries. This is not valid. There should be only one.
You run under Windows....I do not
Access rights to folder for images?
Start Node-Red from command prompt:
node-red-start
study what is printed, copy & paste here so we can help debugging
Microsoft Windows [Version 10.0.19045.2846]
(c) Microsoft Corporation. All rights reserved.
C:\Users\Admin>node-red
4 May 01:04:58 - [info]
Welcome to Node-RED
4 May 01:04:58 - [info] Node-RED version: v3.0.2
4 May 01:04:58 - [info] Node.js version: v18.16.0
4 May 01:04:58 - [info] Windows_NT 10.0.19045 x64 LE
4 May 01:05:00 - [info] Loading palette nodes
4 May 01:05:15 - [info] Worldmap version 2.37.2
4 May 01:05:15 - [info] Dashboard version 3.4.0 started at /ui
cpu backend was already registered. Reusing existing backend factory.
Platform node has already been set. Overwriting the platform with [object Object].
4 May 01:05:16 - [warn] ------------------------------------------------------
4 May 01:05:16 - [warn] [@binsoul/node-red-contrib-string-extract/binsoul-string-extract] Error: Cannot find module 'jsonata'
Require stack:
- C:\Users\Admin.node-red\node_modules@binsoul\node-red-contrib-string-extract\dist\string-extract\Action\ExtractAction.js
- C:\Users\Admin.node-red\node_modules@binsoul\node-red-contrib-string-extract\dist\string-extract\ActionFactory.js
- C:\Users\Admin.node-red\node_modules@binsoul\node-red-contrib-string-extract\dist\string-extract\Node.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\loader.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\index.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\nodes\index.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\index.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\lib\red.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\red.js
4 May 01:05:16 - [warn] ------------------------------------------------------
4 May 01:05:16 - [info] Settings file : C:\Users\Admin.node-red\settings.js
4 May 01:05:16 - [info] Context store : 'default' [module=memory]
4 May 01:05:16 - [info] User directory : \Users\Admin.node-red
4 May 01:05:16 - [warn] Projects disabled : git command not found
4 May 01:05:16 - [info] Flows file : \Users\Admin.node-red\flows.json
4 May 01:05:16 - [info] Server now running at http://127.0.0.1:1880/
4 May 01:05:16 - [warn]
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
4 May 01:05:16 - [info] Starting flows
Ignoring invalid timezone passed to Connection: IST. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
4 May 01:05:16 - [info] Started flows
4 May 01:05:16 - [info] [aedes broker:fa484b8951534360] Binding aedes mqtt server on port: 1883
4 May 01:05:16 - [info] [mqtt-broker:ccd1cd629d5fb1f4] Connected to broker: mqtt://192.168.0.169:1883
Looks to me like your httpStatic setting is in a commented section of the settings file.
Try adding */
above it
2 tips.
-
Please don't post screenshots. We cannot check them in a code editor
-
Use a proper code editor to view the js file (e.g. VSCode) and you will see much clearer what is going on.
As @E1cid points out, the httpStatic
entry is commented out due to a bad edit but since you are using notepad, you cannot see it.
Oh, one more tip, when posting code and logs, please wrap them in a code fence.
canned text:
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
You can edit and correct your post by clicking the pencil icon.
See this post for more details - How to share code or flow json
Thanks all for your valuable support.my problem solved.
thank you
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.