zoukankan      html  css  js  c++  java
  • nodered 再安装

    nodered,虽然是javascript写的,感觉拿来就能用。但是,不管是nodered的本身还是安装的模块,很多底层是依赖于python和c/c++。在安装的时候,会依据环境参数即时编译,gyp。

    nodered发布1.0以后,再次动手完整的走下流程。

    本次是在 ARM64位的低功耗A35的瑞芯微的PX30芯片上,系统为ubuntu-base 19.10上进行的。

    当前nodered的版本为 1.0.3,配合的nodejs为10.15.2。如果nodejs的版本是其它的,发现在安装过程中,会下载该版本的nodejs。

    下载并解压nodejs,具体目录为 /usr/node-v10.15.2/。将/usr/node-v10.15.2/bin/添加到 PATH环境变量中。

    其实node和npm同在一个目录里的,但是不知为什么,在systemd启动的nodered里,无法识别npm,导致palette面板就无法生效。

    在 /usr/bin里创建连接 npm,指向 /usr/node-v10.15.2/bin/npm,palette面板就回来了。

    依次运行如下命令

    apt-get clean

    apt-get update (不是apt-upgrade)

    apt install gcc
    apt install g++

    apt install node-pre-gyp
    apt install node-gyp
    apt install python2 // 2.7 minimal

    为python2创建连接python

    然后再依次安装nodered和模块。

    尽管上面的前置安装已经排除掉了很多问题,但是依然会出现如下类似的问题。

    npm WARN ws@7.2.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
    npm WARN ws@7.2.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
    npm WARN ws@7.2.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
    npm WARN ws@7.2.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.6.2 (node_modules/usb):
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.6.2 install: `prebuild-install --verbose || node-gyp rebuild`
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

    真的安装nodered了。在创建的 /usr/nodered目录下

    npm install --save-dev --unsafe-perm node-red --registry=https://registry.npm.taobao.org

    npm install node-red-contrib-s7 --registry=https://registry.npm.taobao.org
    npm install node-red-contrib-s7-http --registry=https://registry.npm.taobao.org
    npm install node-red-contrib-s7comm --registry=https://registry.npm.taobao.org
    npm install node-red-contrib-winccoa --registry=https://registry.npm.taobao.org

    npm install node-red-contrib-opcua --registry=https://registry.npm.taobao.org

    npm install node-red-contrib-cip-ethernet-ip --registry=https://registry.npm.taobao.org
    npm install node-red-contrib-pccc --registry=https://registry.npm.taobao.org
    npm install depaula-contrib-ethip --registry=https://registry.npm.taobao.org

    npm install compactcom-40-nodes --registry=https://registry.npm.taobao.org

    npm install node-red-contrib-plcs --registry=https://registry.npm.taobao.org
    npm install node-red-contrib-opc-da --registry=https://registry.npm.taobao.org
    npm install node-red-contrib-opcua-isa95 --registry=https://registry.npm.taobao.org

    npm install node-red-dashboard --registry=https://registry.npm.taobao.org

    npm install node-red-node-mysql --registry=https://registry.npm.taobao.org
    npm install node-red-node-feedparser --registry=https://registry.npm.taobao.org
    npm install node-red-node-email --registry=https://registry.npm.taobao.org

    npm install node-red-contrib-modbus --registry=https://registry.npm.taobao.org

    我在装完这些模块之后,得到一个警告

    warning : the expected version of node-opcua is 0.0.56 - actual version is 0.0.61

    如果你发现还有其它问题,比如
    10 Dec 20:11:55 - [s7comm-Error] - Installation of Module net-keepalive failed because we might be on the wrong OS. OS=linux

    这其实还是那些前置安装不到位造成的。

    其实我在安装这些模块之前,还是先安装了

    npm install serialport --registry=https://registry.npm.taobao.org

    npm install bufferutil@^4.0.1 --registry=https://registry.npm.taobao.org
    npm install utf-8-validate@^5.0.2 --registry=https://registry.npm.taobao.org
    npm install usb@1.6.2 --registry=https://registry.npm.taobao.org

    我在摸索排错中还发现,尽管 apt-get install libusb-dev,但是还是会有这个错误

    ../libusb/libusb/os/linux_udev.c:40:10: fatal error: libudev.h: No such file or directory
    40 | #include <libudev.h>

    对于这个问题,暂时误解。但是好像也没影响到正常功能。就是在nodered启动后,没有提示什么不兼容的错误。

    其实在安装中发生了很多错误,可能会有的没有记录下来,或者因为步骤的顺序不同在我这里没有发生,但是能够总结到,如上,先记下了。

    这些装好,包括前置准备,总共占了大概700兆空间。

    写的有点乱,是吧。

  • 相关阅读:
    PHP 类的继承问题
    爬虫第一章
    如何给CBV添加装饰器
    结巴分词 gensim系数矩阵相似度 pypinyin
    elasticsearch 第二章 elasticsearch的详细用法及参数
    运维自动化 第五章 playbook 模块补充
    运维自动化 第四章 模块
    运维自动化 第三章 ansible
    正则补充
    运维自动化 第二章 openpyxl的用法,读写excel内容
  • 原文地址:https://www.cnblogs.com/htsky/p/12090564.html
Copyright © 2011-2022 走看看