Using typeorm library with nativescript


Hi all

I am trying to use with nativescript but am getting these errors:

node_modules/@types/node/index.d.ts(38,11): error TS2300: Duplicate identifier 'MapConstructor'.
node_modules/@types/node/index.d.ts(40,11): error TS2300: Duplicate identifier 'SetConstructor'.
node_modules/@types/node/index.d.ts(49,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'global' must be of type 'any', but here has type 'Global'.
node_modules/@types/node/index.d.ts(73,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'require' must be of type 'NativeScriptRequire', but here has type 'NodeRequire'.
node_modules/@types/node/index.d.ts(85,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'module' must be of type 'NativeScriptModule', but here has type 'NodeModule'.

I think its related to the tsconfig file, but my knowledge is very limited and Mr. Google hasnt been able to help me.

Wondered if anyone can help me with this?

Best wishes



@johnnyzen it looks like typeorm carries along TypeScript definitions for node, which are already available if and when using Visual Studio Code, you could try to remove the @types/node directory manually or removing it through the npm CLI and trying again.


Thanks Pete for your reply.

Although it now builds after removing the types/node directory, I am getting a lot of errors on running the app. A lot of:

Error calling module function messages along with

Error com.tns.NativeScriptException: Failed to find module: “path”, relative to: app/tns_modules


No surprise there, the downloaded package, being a node module uses node functionalities, and NativeScript doesn’t have a shim for every single one of them.

Here’s what one of the community members has been working on lately, bridging the gap between node and the NS runtimes

Do report what the results are after installing it!

Also don’t forget to star the github project if it helped you move on with your project!


Thanks Pete

Seemed to produce a lot of errors, when I tried nodeify with sqlite3 - which is needed for typeorm.

I have abandoned using typeorm and gone back to nativescript-sqlite without ORM.

Many thanks for your suggestions.

Best wishes



Pete, is nativescript-sqlite uses “sqlite” package inside? I guess no because sqlite package inside may use node functions. If its so then in this case typeorm cannot support nativescript’s sqlite because its supposed to work with node sqlite. But its easy to implement new nativescript’s driver in typeorm.


Good thing about the NativeScripts plugins - they are open sourced. When in doubt - you can open the repo and check out the whats and the hows.

To answer your question - does not use the npm sqlite package, it would be inefficient to try to work around a desktop driver, when you can develop/port just the necessary mobile bits (android, ios).


We are planning to use Nativescript with Angular to implement a big commercial application in Australia. I would like to use typeorm with the typescript in the application so that I can use SQLite underneath the typescript data model.

As I understand typeorm does not currently support Nativescript because of the requirement for node shim and lack of Nativescript compliant driver. We can help in validating and testing the driver and contribute back to typeorm if your team is willing to build the driver with us.

We would happy to provide you with a reference if the typeorm goes well for this commercial deployment.



Hi !

This is now a reality. TypeORM is supported now.