-1

I have a node.js project in which i am using node-sqlite3 to read write the sqlite3 database.

I am using devtool to generate the recipe for node.js.

After generating the recipe when i try "bitbake node-project". sqlite3 gives an error of node-gyp and 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.

I dont know how can i fix this. can somebody please help?

Hsn
  • 1,168
  • 2
  • 16
  • 39
  • Which NPM package *specifically* did you try to install, `node-sqlite3` or `sqlite3`? – esqew Jan 15 '21 at 14:52
  • Node-sqlite3.... – Hsn Jan 16 '21 at 15:52
  • Sqlite3 is already working. Just have problem wirh node modulr. There is some error related to node-gyp and node-pre-gyp dependency.. – Hsn Jan 16 '21 at 16:57
  • If you’re running `npm install node-sqlite3`, you’re not installing the right package. The package under that name is not likely what you’re looking for - instead, use `npm install sqlite3`. – esqew Jan 16 '21 at 21:36
  • Yes you are right. But i am not running npm install node-sqlite3. I need this package for yocto build system which is a linux OS. That is why i have written "Yocto" in my question. – Hsn Jan 17 '21 at 09:26

1 Answers1

1

You have just need to follow the steps to install sqlite3 in Yocto.

You have to first check if gcc is available or not with this given command

gcc --version

If not available than install it with given command

bitbake meta-toolchain

After that remove node_modules by

rm -rf node_modules

Install npm globally

Remove package-lock.json file

Now install sqlite3 from source with this command

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

this will allow you to use sqlite3 on Yocto.

Reference Link : https://www.npmjs.com/package/sqlite3