Installing sqlite3 on node in Yocto showing Error node-pre-gyp ERR! stack Error: Failed to execute ‘/usr/local/bin/node

**Installing sqlite3 in node application on node application in Yocto os it allowed to install in

node v14.15.5 SQLite3 v3.22.0

But it was showing error on updated versions.

As of now the latest node and sqlite3 version is

node v15.x

sqlite v3.34

On this version it was unable to install sqlite3 in node application
package and throwing below error Though sqlite3 with v3.34.x was
installed in Yocto.

verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘install’,
‘sqlite3’ ]

error node-pre-gyp info it worked if it ends with ok

error node-pre-gyp info using [email protected]

error node-pre-gyp info using [email protected] | linux | arm

error node-pre-gyp WARN Using request for node-pre-gyp https download

error node-pre-gyp info check checked for
“/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node”
(not found)

error node-pre-gyp http GET
https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm.tar.gz
error node-pre-gyp http 403
https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm.tar.gz

error node-pre-gyp WARN Tried to download(403):
https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm.tar.gz
error node-pre-gyp WARN Pre-built binaries not found for [email protected]
and [email protected] (node-v88 ABI, unknown) (falling back to source
compile with node-gyp)

error node-pre-gyp http 403 status code downloading tarball
https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm.tar.gz

error gyp info it worked if it ends with ok error gyp info using
[email protected]

error gyp info using [email protected] | linux | arm error gyp info ok

error gyp info it worked if it ends with ok error gyp info using
[email protected]

error gyp info using [email protected] | linux | arm

error gyp info find Python using Python version 3.5.3 found at
“/usr/bin/python3”

error gyp info spawn /usr/bin/python3 error gyp info spawn args [

error gyp info spawn args
‘/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py’,
error gyp info spawn args ‘binding.gyp’,

error gyp info spawn args ‘-f’,

error gyp info spawn args ‘make’, error gyp info spawn args ‘-I’,
error gyp info spawn args
‘/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3/build/config.gypi’,

error gyp info spawn args ‘-I’, error gyp info spawn args
‘/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi’,

error gyp info spawn args ‘-I’,

error gyp info spawn args
‘/home/root/.cache/node-gyp/15.8.0/include/node/common.gypi’,

error gyp info spawn args ‘-Dlibrary=shared_library’,

error gyp info spawn args ‘-Dvisibility=default’,

error gyp info spawn args
‘-Dnode_root_dir=/home/root/.cache/node-gyp/15.8.0’,

error gyp info spawn args
‘-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp’,

error gyp info spawn args
‘-Dnode_lib_file=/home/root/.cache/node-gyp/15.8.0/<(target_arch)/node.lib’,

error gyp info spawn args
‘-Dmodule_root_dir=/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3’,

error gyp info spawn args ‘-Dnode_engine=v8’,

error gyp info spawn args ‘–depth=.’, error gyp info spawn args
‘–no-parallel’,

error gyp info spawn args ‘–generator-output’,

error gyp info spawn args ‘build’, error gyp info spawn args
‘-Goutput_dir=.’

error gyp info spawn args ] error gyp info ok error gyp info it worked
if it ends with ok error gyp info using [email protected] error gyp info
using [email protected] | linux | arm

error gyp info spawn make error gyp info spawn args [
‘BUILDTYPE=Release’, ‘-C’, ‘build’ ] error Traceback (most recent call
last): error File “./extract.py”, line 2, in

error import tarfile error ImportError: No module named tarfile error
make: *** [deps/action_before_build.target.mk:13:
Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c] Error 1

error gyp ERR! build error error gyp ERR! stack Error: make failed
with exit code: 2

error gyp ERR! stack at
ChildProcess.onExit/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)

error gyp ERR! stack at ChildProcess.emit (node:events:378:20)

error gyp ERR! stack at Process.ChildProcess._handle.onexit
(node:internal/child_process:290:12)

error gyp ERR! System Linux 4.9.88-Agriscan-6.0.0+g9512b3d

error 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/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node”
“–module_name=node_sqlite3”
“–module_path=/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3/lib/binding/napi-v3-linux-arm”
“–napi_version=7” “–node_abi_napi=napi” “–napi_build_version=3”
“–node_napi_label=napi-v3”

error gyp ERR! cwd
/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3

error gyp ERR! node -v v15.8.0

error gyp ERR! node-gyp -v v7.1.2

error gyp ERR! not ok

error node-pre-gyp ERR! build error

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/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node
–module_name=node_sqlite3 –module_path=/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3/lib/binding/napi-v3-linux-arm
–napi_version=7 –node_abi_napi=napi –napi_build_version=3 –node_napi_label=napi-v3’ (1)

error node-pre-gyp ERR! stack at ChildProcess.
(/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)

error node-pre-gyp ERR! stack at ChildProcess.emit
(node:events:378:20)

error node-pre-gyp ERR! stack at maybeClose
(node:internal/child_process:1067:16)

error node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit
(node:internal/child_process:301:5)

error node-pre-gyp ERR! System Linux 4.9.88-Agriscan-6.0.0+g9512b3d

error node-pre-gyp ERR! command “/usr/local/bin/node”
“/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3/node_modules/.bin/node-pre-gyp”
“install” “–fallback-to-build”

error node-pre-gyp ERR! cwd
/home/root/Livestock-Recording-System/Agriscan/node_modules/sqlite3

error node-pre-gyp ERR! node -v v15.8.0

error node-pre-gyp ERR! node-pre-gyp -v v0.11.0

error node-pre-gyp ERR! not ok verbose exit 1
========================================================================**

Answer

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/ will allow you to install sqlite3 on Yocto.

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

Leave a Reply

Your email address will not be published. Required fields are marked *