CAP ex.4 - Error "Cannot find module 'sqlite3'"
See original GitHub issueHello, I am trying to finish ex. 4 of SAP Cloud Application Programming Model (CAP).
But whenever I try to click on “Books” at service web page I get an error.
The error in Business Application Studio is
GET /catalog/Books [2020-11-21T20:08:46.513Z | ERROR | 1557126]: { Error: Cannot find module ‘sqlite3’ at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at _loadSqlite (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/sqlite/Service.js:9:15) at Promise (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/sqlite/Service.js:31:20) at new Promise (<anonymous>) at _new (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/sqlite/Service.js:30:10) at SQLiteDatabase.acquire (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/sqlite/Service.js:156:19) at SQLiteDatabase.<anonymous> (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/sqlite/Service.js:110:29) code: ‘MODULE_NOT_FOUND’ }
I have installed sqlite and deployed db.
npm install sqlite3 -D
cds deploy --to sqlite:bookshop.db
I created db connection and connected to it without problem.
I think I followed instructions of this and previous exercises and I don’t know what else to do.
Thank you!
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
For me unsetting node path before running CDS deploy worked
run “npm install sqlite3 -D” run “unset NODE_PATH” run “cds deploy --to sqlite”
Hello @qmacro, you are right, I am working in the SAP Business Application Studio as described in Devtoberfest2020 Week 3 SAP Cloud Application Programming Model (CAP).
I am using my trial account, dev space of type SAP Cloud Business Application.
I have tried it and I was successful !
The main reason is that you use command
npm install
which probably installs more packages than in the video SAP Cloud Application Programming Model - Ex. 03 - Associations & adding persistence used commandnpm install sqlite3 -D
. Afternpm install
I was already successful with commandcds deploy --to sqlite:bookshop.db
And also the “Books” link already works.
Thanks very much, I am very happy than I can continue with CAP lessons.
Dasa