NodeJS 在Mac上安装better-sqlite3时出现问题

9jyewag0  于 2022-12-03  发布在  Node.js
关注(0)|答案(3)|浏览(935)

我尝试安装它的原因是使用quick.db作为它的默认驱动程序,但我似乎不能找出错误是什么。也许堆栈溢出的人将能够提供一些帮助。它似乎设法运行通过大部分的安装过程,但失败了接近尾声。它只是一个不停的痛苦尝试使用这个新版本的QuickDB。
这是控制台生成的日志:

npm ERR! code 1
npm ERR! path /Projects/node_modules/better-sqlite3
npm ERR! command failed
npm ERR! command sh -c prebuild-install || npm run build-release
npm ERR! > better-sqlite3@7.5.3 build-release
npm ERR! > node-gyp rebuild --release
npm ERR! 
npm ERR!   TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
npm ERR!   ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
npm ERR! rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
npm ERR! prebuild-install warn install No prebuilt binaries found (target=16.14.0 runtime=node arch=arm64 libc= platform=darwin)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.14.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.10.2 found at "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3"
npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.10/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Projects/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Projects/node_modules/better-sqlite3/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Projects/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/[]/Library/Caches/node-gyp/16.14.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/[]/Library/Caches/node-gyp/16.14.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Projects/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/[]/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Projects/node_modules/better-sqlite3',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! /bin/sh: Projects/node_modules/better-sqlite3/build/Release/lib.host:/Users/[]/Documents/Coding: No such file or directory
npm ERR! node:internal/fs/utils:344
npm ERR!     throw err;
npm ERR!     ^
npm ERR! 
npm ERR! Error: ENOENT: no such file or directory, copyfile '/Projects/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c' -> '/Projects/node_modules/better-sqlite3/build/Release/obj/gen/sqlite3/sqlite3.c'
npm ERR!     at Object.copyFileSync (node:fs:2802:3)
npm ERR!     at Object.<anonymous> (/Projects/node_modules/better-sqlite3/deps/copy.js:25:5)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1103:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
npm ERR!     at node:internal/main/run_main_module:17:47 {
npm ERR!   errno: -2,
npm ERR!   syscall: 'copyfile',
npm ERR!   code: 'ENOENT',
npm ERR!   path: '/Projects/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c',
npm ERR!   dest: '/Projects/node_modules/better-sqlite3/build/Release/obj/gen/sqlite3/sqlite3.c'
npm ERR! }
npm ERR! make: *** [ba23eeee118cd63e16015df367567cb043fed872.intermediate] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (Projects/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 21.5.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Projects/node_modules/.bin/node-gyp" "rebuild" "--release"
npm ERR! gyp ERR! cwd /Projects/node_modules/better-sqlite3
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/[]/.npm/_logs/2022-06-29T19_21_52_645Z-debug-0.log
xbp102n0

xbp102n01#

这听起来很疯狂,但我能让它安装的唯一方法是确保我的目录路径中没有空格。
“/我的工作/我的应用/”-〉“/我的工作/我的应用/”
转至节点18.5.0未修复此问题。

093gszye

093gszye2#

在我的情况下,我使用的节点在17.6.0版本后,更新到18.5.0我可以安装没有问题。

jtoj6r0c

jtoj6r0c3#

删除空格,直到我的项目/订单也为我工作!“/用户/用户名/文档/我的测试/”-〉“/用户/用户名/文档/我的测试/”

相关问题