Skip to content

[ARM64 Android/Termux] Build fails on Node 25+ - napi_typedarray_type error #1854

@Spy-God

Description

@Spy-God

Issue Summary

I am no programmer,i just wanted to setup thelounge with bleeding egde nodejs 25.3.0 but it kept failing. So i used ai to try to solve the issue ,it took quite a bit of workaround so it would be great if their was a official fix for this error.

I have written out the method that worked for me.But it also stated 21 high risks alert so i assumed its better if its left to experts.

Environment:

  • Node: 25.3.0
  • Platform: Android ARM64 (Termux)
  • sqlite3: 5.0.1/5.0.2
  • Error: napi_typedarray_type unknown_array_type = static_cast<napi_typedarray_type>(-1)

Root Cause:
node-addon-api 6.x static initializer uses -1 (invalid enum value 0-15)
Node 25 strict C++ compilation fails

Working Fix (in home dir):

cat > .gyp/include.gypi << 'EOF'
{
'variables': {
'android_ndk_path': '',
'napi_build_version': 9
},
'defines': ['NAPI_VERSION=9'],
'cflags_cc': ['-std=c++17', '-Wno-error=deprecated-declarations']
}
EOF

Steps to Reproduce

1. Fresh Termux (ARM64 Android)

pkg update && pkg upgrade
pkg install nodejs python clang make libsqlite pkg-config binutils

2. Install Python deps (Python 3.12+ missing distutils)

pip install setuptools

3. Create failing environment

mkdir sqlite3-bug && cd sqlite3-bug
npm init -y

4. Install sqlite3 → FAILS with exact error

npm install sqlite3@5.0.1 --build-from-source

In file included from ../src/backup.cc:2:
/data/data/com.termux/files/home/node_modules/node-addon-api/napi.h:911:39: error:
in-class initializer for static data member is not a constant expression
911 | static const napi_typedarray_type unknown_array_type = static_cast<napi_typedarray_type>(-1);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/home/node_modules/node-addon-api/napi.h:911:60: note:
integer value -1 is outside the valid range of values [0, 15] for the enumeration type 'napi_typedarray_type'

Version

sqlite3@5.1.7

Node.js Version

v25.3.0

How did you install the library?

npm install sqlite3@5.0.1 --build-from-source

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions