node-red安装

Node-RED v2.2.2

拉取源码

服务器没有安装 git 安装先git  这个很重要

拉取源码
git clone https://github.com/node-red/node-red.git --recursive


进入源码目录
cd node-red
安装
npm install

    安装node-red依赖项
    如果出现 npm ERR! code 128 错误 
    就执行清除缓存
    npm cache clean --force


    如果出现 npm ERR! exited with error code: 128 错误 
    就执行清除缓存
    git config --global url."https://".insteadOf git://

再安装
npm install

	出现这个就算安装依赖成功了
        77 packages are looking for funding
          run `npm fund` for details

        found 5 vulnerabilities (3 moderate, 2 high)
          run `npm audit fix` to fix them, or `npm audit` for details




构建代码
npm run build





前台启动
npm start

关闭
Ctrl+c

生成密码
node-red admin hash-pw
Password:在这里输入密码 然后回车 zz142536
$2b$08$pguX1rCpevdb.l.hc3zi/uSyBWTf5.uVmD3AYUZcpeEazvvK3MKBK

//windows 配置文件路径
C:\Users\Administrator\.node-red\settings.js
//大概在80行的位置 去掉注释 改一下哈希  保存

//大概长这样
    adminAuth: {
        type: "credentials",
        users: [{
            username: "admin",
            password: "$2b$08$pguX1rCpevdb.l.hc3zi/uSyBWTf5.uVmD3AYUZcpeEazvvK3MKBK",
            permissions: "*"
        }]
    },


或者直接替换为下面的配置就好


全局安装

//linux命令
sudo npm install -g --unsafe-perm node-red
//或者
sudo npm install -g node-red

//windows 安装命令
npm install -g --unsafe-perm node-red
//或者
npm install -g node-red

启动

node-red

//要关闭的话直接关掉黑窗口就好

启动后会生成配置文件 到 /Users/nol/.node-red/settings.js

具体参考官方文档 [设置文件:节点-红色 (nodered.org)](https://nodered.org/docs/user-guide/runtime/settings-file)

配置文件路径

//windows 配置文件路径
C:\Users\Administrator\.node-red\settings.js

生成密码

node-red admin hash-pw
Password:在这里输入密码 然后回车 zz142536
$2b$08$pguX1rCpevdb.l.hc3zi/uSyBWTf5.uVmD3AYUZcpeEazvvK3MKBK
$2b$08$lFndYSl80Vao26jntHLUJO5kK40bhz6u8VrV.CNNyNRQzXyIyBEZq
//windows 配置文件路径
C:\Users\Administrator\.node-red\settings.js
//大概在80行的位置 去掉注释 改一下哈希  保存

//大概长这样
    adminAuth: {
        type: "credentials",
        users: [{
            username: "admin",
            password: "$2b$08$pguX1rCpevdb.l.hc3zi/uSyBWTf5.uVmD3AYUZcpeEazvvK3MKBK",
            permissions: "*"
        }]
    },

使用 pm2 后台启动

//pm2文档
//https://www.cnblogs.com/yalong/p/13931999.html

//启动
pm2 start node-red
//列出所有
pm2 list
//关闭所有
pm2 kill
//关闭
pm2 stop node-red

linux

配置地址
/root/.node-red
程序地址
/usr/local/lib/node_modules/node-red

后台启动追加日记: 
forever start -l forever.log -o out.log -e err.log -a /usr/local/lib/node_modules/node-red/red.js
"关闭后台": "
forever stop /usr/local/lib/node_modules/node-red/red.js


配置

settings.js

大概在77行

    /** To password protect the Node-RED editor and admin API, the following
     * property can be used. See http://nodered.org/docs/security.html for details.
     * zz142536
     */
    adminAuth: {
        type: "credentials",
        users: [{
            username: "admin",
            password: "$2b$08$lFndYSl80Vao26jntHLUJO5kK40bhz6u8VrV.CNNyNRQzXyIyBEZq",
            permissions: "*"
        }],
        sessionExpiryTime: 86400,
        default: {
            permissions: "read"
        }
    },

启动

//进入目录
cd E:\aa\nodered\node-red
//前台启动
npm start



//pm2文档
//https://www.cnblogs.com/yalong/p/13931999.html

//启动
pm2 start packages/node_modules/node-red/red.js
//列出所有
pm2 list
//关闭所有
pm2 kill
//关闭
pm2 stop node-red

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

QQ547176052

觉得对你有帮助就多多鼓励!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值