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兆空間。

寫的有點亂,是吧。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM