nodejs中的serialport编译

最近在研究在i.mx6ul中使用node-red。

基于 cortex-a7的低功耗,是选择nxp 的i.mx6ul的主要原因。但是没想到,在这个芯片上并不像其他各种pi的板载资源充足。最重要的一点是yocto定制的系统,过于精简,导致nodejs无法运行。

就算是重新编译nodejs,去掉动态依赖,但是其他模块也面临着同样的问题。

当然了,用ubuntu-base替换rootfs是个不错的方法。

不过在安装node-red-contrib-modbus却是怎么都无法完成。各种排错和尝试,真的是崩溃了。

问题的重点是在安装过程中,需要安装serialport这个模块,总是编译失败。

> serialport@6.2.2 install /usr/local/lib/node_modules/node-red-contrib-modbus/node_modules/modbus-serial/node_modules/serialport
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=10.14.1 runtime=node arch=arm platform=linux)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Linux 3.14.38-6UL_ga-00004-gc2cfa49
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/node-red-contrib-modbus/node_modules/modbus-serial/node_modules/serialport
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @serialport/bindings@2.0.3 (node_modules/node-red-contrib-modbus/node_modules/@serialport/bindings):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @serialport/bindings@2.0.3 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! serialport@6.2.2 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@6.2.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-12-06T07_40_04_541Z-debug.log

看到这里,说明你是需要答案的。不做解释了,办法就是

npm --registry https://registry.npm.taobao.org install -g --unsafe-perm node-red-contrib-modbus

 

posted @ 2019-02-12 09:13  蓝色牧客  阅读(6807)  评论(1编辑  收藏  举报