Skip to content
sakazuki edited this page Apr 29, 2021 · 16 revisions

Environment Variables

  • The NRD_ prefix means that Node-RED-Desktop uses them
Name Description
NRD_LISTEN_IP=127.0.0.1 Node-RED server's listen IP
NRD_LISTEN_PORT=1880 Node-RED server's listen Port
NRD_NGROK_START_ARGS=demo When you define this, ngrok is started with the following command
ngrok start --log=stdout ${NRD_NGROK_START_ARGS}
NRD_AUTO_REBUILD=false Disable to auto execute electron-rebuild, even if "was compiled against a different Node.js version using" error occurs
NRD_IP_ALLOWS=118.123.45.67,2001:db8:85a3:1:0:8a2e:370:7334 Allow to access admin page from specific ip addresses.
NODE_DEBUG=Node-RED-Desktop-debug show DevTools menu
UPDATE_CHANNEL=dev set update channel. (not supported yet)

Mac: PATH settings example in launchd

$ vi ~/Library/LaunchAgents/setenv.PATH.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
  <dict>
  <key>Label</key>
  <string>setenv.PATH</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>/bin/launchctl setenv PATH /home/sakazuki/.nvm/versions/node/v12.3.1/bin:$PATH</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

$ launchctl load ~/Library/LaunchAgents/setenv.PATH.plist
$ killall Dock

Resources

Related Directory

  • Windows

    • %USERPROFILE%\.Node-RED-Desktop\
    • %USERPROFILE%\AppData\Local\Programs\Node-RED-Desktop\
    • %USERPROFILE%\AppData\Roaming\Node-RED-Desktop\
  • Mac

    • ${HOME}/.Node-RED-Desktop/
    • ${HOME}/Library/Application Support/Node-RED-Desktop/
    • ${HOME}/Library/Logs/Node-RED-Desktop/

Use node using native Node.js modules

(ex. node-red-node-serialport)

You will find such an error output in log,

[2019-05-25 12:05:35.946] [info]  - node-red-node-serialport:serial-port : Error: The module '\\?\C:\Users\sakazuki\.Node-RED-Desktop\node_modules\@serialport\bindings\build\Release\bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
[2019-05-25 12:05:49.030]

If you had already installed electron-rebuild,
Node-RED-Desktop will fix this automatically.

How to fix this error manually

You need some steps

  • Prerquired: node v14.x.x
C:\Users\sakazuki>npm install -g electron-rebuild
C:\Users\sakazuki>cd %USERPROFILE%\.Node-RED-Desktop
C:\Users\sakazuki>set ELECTRON_VERSION=12.0.5
C:\Users\sakazuki\.Node-RED-Desktop>electron-rebuild --version %ELECTRON_VERSION%
√ Rebuild Complete
C:\Users\sakazuki\.Node-RED-Desktop>

Restart Node-RED-Desktop, then it will work well.

How to get ngrok public url in flow

  • You can get a ngrok public url from NGROK_URL global variable

How to use context storage

Put the settings.js in userdir ( %USERPROFILE%\.Node-RED-Desktop\settings.js )

module.exports = {
  contextStorage: {
    default: {
      module:"localfilesystem"
    }
  }
}
  • Node-RED-Desktop loads this user settings.js first, and override it with Node-RED-Desktop default settings.

Procedure to setup the resource of this application.

How to create icon files

  1. Download a SVG file from Node-RED resource page
  2. Export a PNG file (1024x1024) with Boxy SVG or others.
  3. Use electron-icon-generator to create icon files