You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在同一笔记本运行两个Node-RED实例并安装指定fork版本?

Installing the Forked Node-RED & Running Multiple Instances

Hey there! Let me break down exactly how to get this forked Node-RED version up and running, plus key considerations for managing multiple instances on your laptop.

Installing the Forked Version

Since this is a custom fork, you can't use the standard official installation commands. Here are two common approaches:

Option 1: Clone the Repository (for development/modification)

  • First, clone the fork to your local machine:
    git clone https://github.com/aryeharmon/node-red.git
    
  • Navigate into the cloned directory:
    cd node-red
    
  • Install all required dependencies:
    npm install
    
  • Skip npm link if you have the official Node-RED installed globally—this avoids overwriting your global node-red command. Instead, run the fork directly from the directory or use it as a dependency in a custom Node.js project.

Option 2: Install Directly via npm (for quick use)

If you don't need to modify the fork's code, install it directly from the GitHub repo into your project:

npm install aryeharmon/node-red

This adds the forked version to your project's node_modules folder without affecting global installations.

Running Multiple Node-RED Instances

The fork's core feature is supporting embedded multiple instances. Here's a basic example of how to set this up in a custom Node.js script:

const http = require('http');
const RED = require('node-red');

// Configure and start first instance
const server1 = http.createServer();
const instance1Settings = {
    httpAdminRoot: '/red-editor-1', // Unique editor path
    httpNodeRoot: '/red-api-1',     // Unique API endpoint path
    userDir: './.node-red-instance-1', // Separate config storage
    port: 1880                      // Unique port number
};
RED.init(server1, instance1Settings);
server1.listen(instance1Settings.port);
RED.start();

// Configure and start second instance
const server2 = http.createServer();
const instance2Settings = {
    httpAdminRoot: '/red-editor-2',
    httpNodeRoot: '/red-api-2',
    userDir: './.node-red-instance-2',
    port: 1881
};
RED.init(server2, instance2Settings);
server2.listen(instance2Settings.port);
RED.start();

Critical Configuration Rules

  • Unique User Directories: Each instance must have its own userDir. This stores flow configs, installed nodes, and settings—sharing a directory will cause data corruption and conflicts.
  • Distinct Ports & Paths: Ensure port, httpAdminRoot, and httpNodeRoot are unique across instances. Port conflicts will crash your instances, while overlapping paths will break editor/API access.

Key Things to Keep in Mind

  • Avoid Global Conflicts: If you have the official Node-RED installed globally, never run npm link on the fork—it will overwrite your global node-red command. Stick to local project installations or use npx to run the fork version.
  • Third-Party Node Compatibility: Most custom Node-RED nodes are built for the official version. Test any nodes you rely on with this fork to ensure they work as expected.
  • Upstream Sync: Forks don't automatically pull updates from the official Node-RED repo. If you need bug fixes or new features, you'll have to manually merge upstream changes, or check if the fork's maintainer has already done so.
  • Resource Limits: Each Node-RED instance uses memory and CPU. Keep an eye on your laptop's performance—if you notice lag, reduce the number of instances or optimize your flows to be more efficient.

内容的提问来源于stack exchange,提问作者Zero G

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:26:38