This npm package contain the current DuckDB version specifically built to be able to run on Amazon Linux 2-based environments, such as AWS Lambda functions (only with x86 architecture). The original duckdb npm package unfortunately doesn't work on AL2 due to the OSes outdated package versions, and the packaging.
You can install it for your project by running
npm i --save duckdb-lambda-x86
As this package is a repackaged version of the duckdb npm package, the same Node.js API can be used. Have a look at the docs to learn more.
const duckdb = require('duckdb-lambda-x86');
const db = new duckdb.Database(':memory:'); // or a file name for a persistent DB
You can alternatively use the free and public Lambda layer tobilg/duckdb-nodejs-layer.