-1

我有一个 node.js 项目,我在其中使用 node-sqlite3 来读写 sqlite3 数据库。

我正在使用 devtool 为 node.js 生成配方。

当我尝试“bitbake node-project”时生成配方后。sqlite3 给出了 node-gyp 和 node-pre-gyp 的错误。

ERROR: node-sqlite3-3.1.13+g.....
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@12.14.1 | linux | x64
gyp info find Python using Python version 3.6.9 found at "/home/user/build/tmp-glibc/hosttools/python3"
gyp http GET https://nodejs.org/download/release/v12.14.1/node-v12.14.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v12.14.1/node-v12.14.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v12.14.1/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v12.14.1/SHASUMS256.txt
gyp info spawn /home/user/build/tmp-glibc/hosttools/python3
gyp info spawn args [
gyp info spawn args   '/home/user/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/recipe-sysroot-native/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/user/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/git/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/user/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/recipe-sysroot-native/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/tmpdbkdzu8w/.cache/node-gyp/12.14.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/tmp/tmpdbkdzu8w/.cache/node-gyp/12.14.1',
gyp info spawn args   '-Dnode_gyp_dir=/home/user/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/recipe-sysroot-native/usr/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/tmp/tmpdbkdzu8w/.cache/node-gyp/12.14.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/user/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/git',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/user/yocto_mapro/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/recipe-sysroot-native/usr/lib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 5.4.0-58-generic
gyp ERR! command "/home/user/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/recipe-sysroot-native/usr/bin/node" "/home/user/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/recipe-sysroot-native/usr/bin/node-gyp" "--arch" "arm" "configure"
gyp ERR! cwd /home/user/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi/node-sqlite3/3.1.13+gitAUTOINC+72bddafddc-r0/git
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok 
WARNING: exit code 1 from a shell command.

我不知道我该如何解决这个问题。有人可以帮忙吗?

4

1 回答 1

1

您只需要按照步骤在 Yocto 中安装 sqlite3。

您必须首先使用这个给定的命令检查gcc是否可用

gcc --version

如果不可用,则使用给定命令安装它

bitbake meta-toolchain

之后删除 node_modules

rm -rf node_modules

全局安装 npm

删除package-lock.json文件

现在使用此命令从源代码安装 sqlite3

npm install --build-from-source --sqlite=/usr/local/opt/sqlite/

这将允许您在 Yocto 上使用 sqlite3。

参考链接:https ://www.npmjs.com/package/sqlite3

于 2021-03-22T13:40:27.687 回答