{"record":{"id":"331a1114d49c8183","repo":"typeorm/typeorm","slug":"nativescript-package-has-not-been-found-installed","errorCode":null,"errorMessage":"Nativescript package has not been found installed. Please run \"npm install nativescript-sqlite\".","messagePattern":"Nativescript package has not been found installed\\. Please run \"npm install nativescript-sqlite\"\\.","errorType":"exception","errorClass":"DriverPackageNotInstalledError","httpStatus":null,"severity":"error","filePath":"src/driver/nativescript/NativescriptDriver.ts","lineNumber":137,"sourceCode":"                        [],\n                        (err: Error, result: any): any => {\n                            if (err) return fail(err)\n                            // We are all set\n                            ok(db)\n                        },\n                    )\n                },\n            )\n        })\n    }\n\n    /**\n     * If driver dependency is not given explicitly, then try to load it via \"require\".\n     */\n    protected loadDependencies(): void {\n        this.sqlite = this.driver\n        if (!this.driver) {\n            throw new DriverPackageNotInstalledError(\n                \"Nativescript\",\n                \"nativescript-sqlite\",\n            )\n        }\n    }\n}\n","sourceCodeStart":119,"sourceCodeEnd":144,"githubUrl":"https://github.com/typeorm/typeorm/blob/df07bf1ef46f62f72077699fe4cd2c03b2f666e4/src/driver/nativescript/NativescriptDriver.ts#L119-L144","documentation":"Thrown by NativescriptDriver.loadDependencies() when no driver instance was provided. The NativeScript driver expects the nativescript-sqlite module to be injected via the `driver` connection option; if it is absent the DriverPackageNotInstalledError fires, naming the missing npm package.","triggerScenarios":"Creating a DataSource with type 'nativescript' without supplying the driver option (this.driver) and without the nativescript-sqlite package resolvable in the project. The check at line 135-136 sets this.sqlite = this.driver then throws if falsy.","commonSituations":"Developing a NativeScript app where nativescript-sqlite was not installed or the require path changed. Forgetting to pass { driver: require('nativescript-sqlite') } in the connection options.","solutions":["Run npm install nativescript-sqlite in your NativeScript project.","Pass the driver explicitly in options: new DataSource({ type: 'nativescript', driver: require('nativescript-sqlite'), database: 'app.db' }).","Verify the module resolves from your bundle (webpack/metro config) before constructing the DataSource."],"exampleFix":"// before\nconst ds = new DataSource({ type: 'nativescript', database: 'app.db' });\nawait ds.initialize();\n\n// after\nconst sqlite = require('nativescript-sqlite');\nconst ds = new DataSource({ type: 'nativescript', database: 'app.db', driver: sqlite });\nawait ds.initialize();","handlingStrategy":"validation","validationCode":"const sqlite = require('nativescript-sqlite');\nif (!sqlite) throw new Error('nativescript-sqlite not installed');\nconst ds = new DataSource({ type: 'nativescript', database: 'app.db', driver: sqlite });\nawait ds.initialize();","typeGuard":"function hasNativescriptDriver(opts: { driver?: any }): opts is { driver: NonNullable<any> } {\n  return opts.driver != null;\n}","tryCatchPattern":null,"preventionTips":["Install nativescript-sqlite before building the NativeScript app.","Pass the driver instance explicitly to avoid relying on require resolution."],"tags":["nativescript","missing-dependency","driver","configuration"],"backgroundTag":null,"analyzedSha":"df07bf1ef46f62f72077699fe4cd2c03b2f666e4","analyzedAt":"2026-08-07T05:58:41.164Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}