cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot find module 'sqlite3' error in SAP business application studio

grady_lv
Employee
Employee
0 Kudos

Tutorial: https://developers.sap.com/tutorials/cp-cap-java-reusable-service.html
--------------------------

Write here what you need help with ...

I'm followed this tutorial step by step. Below error occurs when do the cds deploy after npm install sqlite3.

user: products-service $ cds deploy --to sqlite

[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 Promise (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/sqlite/Service.js:21:17) at new Promise (<anonymous>) at _new (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/sqlite/Service.js:19:10) at SQLiteDatabase.acquire (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/sqlite/Service.js:130:19) at SQLiteDatabase.begin (/extbin/npm/globals/lib/node_modules/@sap/cds-runtime/lib/db/Service.js:48:23) at Function.for (/extbin/npm/globals/lib/node_modules/@sap/cds/lib/srv/Transaction.js:47:26)

I have tried the npm install sqlite3 -D and then npm install, and also re-installed the cds lib. but all the same..

Anyone who ever faced this issue before. Thank for your answer in advance.

Regards,

Grady

iwona_hahn
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Grady,

There was a related question here, where I suggested to try out the provided solution here. Hope that helps.

Best regards,
Iwona

patrickwenger
Participant
0 Kudos

Hi. I had a similar problem. My solution was to change the version number of sqlite3 in package.json from "^5.0.0" to "5.0.0" (just remove the caron sign (^).

View Entire Topic
0 Kudos

Solution -

1. run "npm install sqlite --D"
2. run "unset NODE_PATH"
3. cds deploy --to sqlite