我在我的 pi 上运行 raspbian,当我运行“npm rebuild”以使我的 npm 安装的 node-red 节点包出现在我的 node-red 界面上时。当我运行“npm rebuild”时,它会进入一个永无止境的 makefile 以尝试从源代码构建(或者至少持续了一个多小时而没有明显进展):
sqlite3@4.0.9 install /home/pi/.node-red/node_modules/sqlite3
node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.9/node-v57-linux-arm.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.9 and node@8.11.4 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/home/pi/.node-red/node_modules/sqlite3/build'
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep
Release/obj/gen/sqlite-autoconf-3280000/sqlite3.c
TOUCH Release/obj.target/deps/action_before_build.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3280000/sqlite3.o
^Cdeps/sqlite3.target.mk:123: recipe for target
'Release/obj.target/sqlite3/gen/sqlite-autoconf-3280000/sqlite3.o' failed
make: *** [Release/obj.target/sqlite3/gen/sqlite-autoconf-3280000/sqlite3.o] Interrupt
简而言之,我不能使用 contrib-nodes 因为 sqlite 不会加载——这是解决我的问题的理想解决方案。
当我运行“sudo npm rebuild”时,我遇到了错误:
sqlite3@4.0.9 install /home/pi/.node-red/node_modules/sqlite3
node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.9/node-v72-linux-arm.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.9 and node@12.4.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/12.4.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/.node-red/node_modules/sqlite3/.node-gyp"
make: Entering directory '/home/pi/.node-red/node_modules/sqlite3/build'
make: *** No rule to make target '../.node-gyp/12.4.0/include/node/common.gypi', needed by 'Makefile'. Stop.
make: Leaving directory '/home/pi/.node-red/node_modules/sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.42-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
"build" "--fallback-to-build" "--module=/home/pi/.node-
red/node_modules/sqlite3/lib/binding/node-v72-linux-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v72-linux-arm" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/pi/.node-red/node_modules/sqlite3
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
build --fallback-to-build --module=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v72-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v72-linux-arm --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/.node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:200:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Linux 4.19.42-v7+
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/.node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/.node-red/node_modules/sqlite3
node-pre-gyp ERR! node -v v12.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v72-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v72-linux-arm --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.0.9 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.0.9 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/2019-06-15T23_16_13_885Z-debug.log
如果有帮助,我会在以后的评论中附上调试日志。
我试过按照这里的建议: bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`
在这里: npm 重建期间 npm-gyp 出错
在这两种情况下,这意味着遵循所有建议,包括找到正确的 python 版本并尝试通过 python 框架路由命令(尝试在 python 中运行 npm)
除了登录 aws 以尝试下载构建二进制文件 4.0.9,我还使用 nvm 安装节点 v10.16.0、v8.16.0 和 v12.4.0 并在所有三个框架上运行“npm rebuild”以几乎相同的输出
我希望“npm rebuild”允许我使用 sql 节点和 telegrambot 节点,这样我就可以通过它获得一些基本流程,以便我的演示即将推出。