Skip to content

Error in better-sqlite3 module #928

@Kaderde

Description

@Kaderde

Tutorials: https://developers.sap.com/tutorials/build-cap-app.html

when running cds watch with SAP CAP, in the section Create a CAP project

we got an error : failing to start the server due to the better-sqlite3 module not finding its native bindings file (better_sqlite3.node).

to resolve it, npm install is needed to download and install the SQLite adapter package the project depends on, before running the command
cds watch

The "Full Stack Cloud Application" option, selected during dev space creation, only pre-installs certain tools and extensions into the environment. For example:

  • @sap/cds CLI
  • Fiori tools
  • Node.js
  • Terminal with npm
  • CDS language support

But project-specific dependencies, like @cap-js/sqlite, are declared in package.json and must be installed by developer using npm install.

see below details of the error

user: incident-management $ cds watch

cds serve all --with-mocks --in-memory?
live reload enabled for browsers

    ___________________________

[cds] - loaded model from 3 file(s):

srv/services.cds
db/schema.cds
../../../../extbin/globals/pnpm/5/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@sap/cds/common.cds

[cds] - connect using bindings from: { registry: '~/.cds-services.json' }
[cds] - connect to db > sqlite { url: ':memory:' }
/> deployment to in-memory database. failed

❗️ ERROR on server start: ❗️

Error: Could not locate the bindings file. Tried:
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/build/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/Debug/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/out/Release/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/Release/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/build/default/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/compiled/22.13.1/linux/x64/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/lib/binding/node-v127-linux-x64/better_sqlite3.node
at bindings (/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/bindings/bindings.js:126:9)
at new Database (/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/lib/database.js:48:64)
at create (/extbin/globals/pnpm/5/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]_/node_modules/@cap-js/sqlite/lib/SQLiteService.js:33:21)
at Pool._createResource (/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/generic-pool/lib/Pool.js:319:42)
at Pool._dispense (/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/generic-pool/lib/Pool.js:237:12)
at Pool.acquire (/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/generic-pool/lib/Pool.js:468:10)
at SQLiteService.acquire (/extbin/globals/pnpm/5/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]_/node_modules/@cap-js/db-service/lib/common/DatabaseService.js:106:28)
at SQLiteService.begin (/extbin/globals/pnpm/5/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]_/node_modules/@cap-js/db-service/lib/common/DatabaseService.js:66:27)
at SQLiteService._begin [as dispatch] (/extbin/globals/pnpm/5/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@sap/cds/lib/srv/srv-tx.js:201:38)
at SQLiteService.run (/extbin/globals/pnpm/5/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@sap/cds/lib/srv/cds.ServiceClient.js:63:17) {
tries: [
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/build/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/build/Debug/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/out/Debug/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/Debug/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/out/Release/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/Release/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/build/default/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/compiled/22.13.1/linux/x64/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node',
'/extbin/globals/pnpm/5/.pnpm/[email protected]/node_modules/better-sqlite3/lib/binding/node-v127-linux-x64/better_sqlite3.node'
]
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions