无法在我的 Raspberry PI 上安装 Better-Sqlite3

Posted

技术标签:

【中文标题】无法在我的 Raspberry PI 上安装 Better-Sqlite3【英文标题】:Can't get Better-Sqlite3 installed on my Raspberry PI 【发布时间】:2021-04-27 19:00:20 【问题描述】:

我目前正尝试在我的 Raspberry PI 上运行我的 Discord Bot,但我无法在其上安装 Better-Sqlite3。我真的不知道如何处理所有这些错误或他们告诉我的内容,所以我希望这里有人可以帮助我解决我的问题。如果您需要任何其他信息,请告诉我。


> better-sqlite3@7.1.2 install /home/pi/Discord Bot/node_modules/better-sqlite3
> prebuild-install || npm run build-release

prebuild-install WARN install No prebuilt binaries found (target=10.23.1 runtime=node arch=arm libc= platform=linux)

> better-sqlite3@7.1.2 build-release /home/pi/Discord Bot/node_modules/better-sqlite3
> node-gyp rebuild --release

make: Entering directory '/home/pi/Discord Bot/node_modules/better-sqlite3/build'
  TOUCH b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3 b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
/bin/sh: 1: Bot/node_modules/better-sqlite3/build/Release/lib.host:/home/pi/Discord: not found
/home/pi/Discord Bot/node_modules/better-sqlite3/deps/extract.js:8
process.on('unhandledRejection', (err) =>  throw err; );
                                            ^

CwdError: ENOENT: Cannot cd into '/home/pi/Discord Bot/node_modules/better-sqlite3/build/Release/obj/gen/sqlite3'
    at fs.stat (/home/pi/Discord Bot/node_modules/tar/lib/mkdir.js:74:14)
    at FSReqWrap.oncomplete (fs.js:153:21)
make: *** [deps/locate_sqlite3.target.mk:17: b857c92884e9598d609f6be182a2595df7a8e00f.intermediate] Error 1
rm b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
make: Leaving directory '/home/pi/Discord Bot/node_modules/better-sqlite3/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:191:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.4.51-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/pi/Discord Bot/node_modules/better-sqlite3
gyp ERR! node -v v10.23.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! better-sqlite3@7.1.2 build-release: `node-gyp rebuild --release`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the better-sqlite3@7.1.2 build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2021-01-23T13_30_26_759Z-debug.log
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/Discord Bot/package.json'
npm WARN Discord Bot No description
npm WARN Discord Bot No repository field.
npm WARN Discord Bot No README data
npm WARN Discord Bot No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! better-sqlite3@7.1.2 install: `prebuild-install || npm run build-release`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the better-sqlite3@7.1.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!     /home/pi/.npm/_logs/2021-01-23T13_30_27_548Z-debug.log

npm 启动错误:

pi@raspberrypi:~/Discord Bot $ npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/pi/Discord Bot/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/Discord Bot/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2021-01-23T17_14_30_893Z-debug.log

【问题讨论】:

this 有帮助吗? 遗憾的是,我尝试了该帖子的很多内容,但没有任何效果。我在输入 npm start 时也会出错 npm start 错误是否来自未安装的库? 我把错误贴在普通帖子里 【参考方案1】:

好的,我找到了解决问题的方法。我在机器人的文件夹名称中有一个“空格”,这就是为什么安装 better-sqlite3 的程序找不到该文件夹​​并崩溃的原因。我刚刚删除了空间,它工作得很好。

【讨论】:

以上是关于无法在我的 Raspberry PI 上安装 Better-Sqlite3的主要内容,如果未能解决你的问题,请参考以下文章

如何让 OpenCV 在 Raspberry Pi 4 (Raspbian Buster) 上完全运行?

在 Raspberry Pi 上安装新的 Linux 发行版

在 Raspberry Pi Jessie 上使用 OpenGL

Raspberry Pi 的 OpenDDS 工作问题

安装 python 模块 ImportError (dlib, imutils) raspberry pi

无法在 Raspberry Pi 上从 Dockerfile 安装 dlib