Node-RED系列(十三):三种方式安装启动安装Node-Red

这把我C 2021-02-20 17:52:54 13042

Node-RED系列文章目前已经写了11篇,介绍了Node-RED的安装以及默认安装的一些基本节点的使用,作为物联网的一个可视化拖动的流程,Node-RED的确实很容易上手。还没开始学习的同学可以先看下我以前的文章

由于很多同学问我在安装Node-RED时总是报错,这里我就给大家总结几种非常方便,快捷的安装和开发方式。
在安装时,请大家保持网络畅通,很多包是在国外,需要耐心等待,此外npm的源可以切换成淘宝。

安装方式(一)npm安装

首先需要安装nodejs

sudo npm install -g --unsafe-perm node-red
node-red

打开 http://localhost:1880

源码编译

首先需要安装git, nodejs,可以本地开发。

下载安装
git clone https://github.com/node-red/node-red.git
cd node-red

执行 npm install

执行编辑

npm run build

$ npm run build

> node-red@1.2.9 build D:\download\node-red-master\node-red-master
> grunt build

Running "clean:build" (clean) task
>> 0 paths cleaned.

Running "jsonlint:messages" (jsonlint) task
>> 35 files lint free.

Running "jsonlint:keymaps" (jsonlint) task
>> 1 file lint free.

Running "concat:build" (concat) task

Running "concat:vendor" (concat) task

Running "copy:build" (copy) task
Created 10 directories, copied 83 files

Running "uglify:build" (uglify) task
>> 4 files created 1.93 MB → 745.03 kB

Running "sass:build" (sass) task

Running "attachCopyright:js" (attachCopyright) task
Attached copyright to packages/node_modules/@node-red/editor-client/public/red/red.min.js
Attached copyright to packages/node_modules/@node-red/editor-client/public/red/main.min.js

Running "attachCopyright:css" (attachCopyright) task
Attached copyright to packages/node_modules/@node-red/editor-client/public/red/style.min.css

Done.
开发启动运行

执行 npm start

$ npm start

> node-red@1.2.9 start D:\download\node-red-master\node-red-master
> node packages/node_modules/node-red/red.js

20 Feb 17:28:20 - [info]

Welcome to Node-RED
===================

20 Feb 17:28:20 - [info] Node-RED version: v1.2.9
20 Feb 17:28:20 - [info] Node.js  version: v12.15.0
20 Feb 17:28:20 - [info] Windows_NT 10.0.18363 x64 LE
20 Feb 17:28:21 - [info] Loading palette nodes
20 Feb 17:28:22 - [info] Settings file  : C:\Users\fizz\.node-red\settings.js
20 Feb 17:28:22 - [info] Context store  : 'default' [module=memory]
20 Feb 17:28:22 - [info] User directory : C:\Users\fizz\.node-red
20 Feb 17:28:22 - [warn] Projects disabled : editorTheme.projects.enabled=false
20 Feb 17:28:22 - [info] Flows file     : C:\Users\fizz\.node-red\flows_GZDP-DZ-00046.json
20 Feb 17:28:22 - [info] Creating new flow file
20 Feb 17:28:22 - [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.
---------------------------------------------------------------------

20 Feb 17:28:22 - [info] Starting flows
20 Feb 17:28:22 - [info] Started flows
20 Feb 17:28:22 - [info] Server now running at http://127.0.0.1:1880/

打开http://127.0.0.1:1880/

停止服务请使用 ctrl+c

docker启动

首先需要安装Docker

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red

打开调试日志

Welcome to Node-RED
    ===================

    10 Oct 12:57:10 - [info] Node-RED version: v1.2.0
    10 Oct 12:57:10 - [info] Node.js  version: v10.22.1
    10 Oct 12:57:10 - [info] Linux 4.19.76-linuxkit x64 LE
    10 Oct 12:57:11 - [info] Loading palette nodes
    10 Oct 12:57:16 - [info] Settings file  : /data/settings.js
    10 Oct 12:57:16 - [info] Context store  : 'default' [module=memory]
    10 Oct 12:57:16 - [info] User directory : /data
    10 Oct 12:57:16 - [warn] Projects disabled : editorTheme.projects.enabled=false
    10 Oct 12:57:16 - [info] Flows file     : /data/flows.json
    10 Oct 12:57:16 - [info] Creating new flow file
    10 Oct 12:57:17 - [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.
    ---------------------------------------------------------------------

    10 Oct 12:57:17 - [info] Starting flows
    10 Oct 12:57:17 - [info] Started flows
    10 Oct 12:57:17 - [info] Server now running at http://127.0.0.1:1880/

r如果需要使用密码登录

docker run -it -p 1880:1880 -v $PWD/data:/data -e TZ=Asia/Shanghai --name nodered -d nodered/node-red

所有安装启动方式 的访问端口都是1880,
打开htpp://localhost:1880 看到以下页面就表示已经安装,启动成功了

声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包 89 9 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
这把我C
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区