Installation
Installation
- Install the npm package:
npm install typeorm --save
- You need to install
reflect-metadatashim:
npm install reflect-metadata --save
and import it somewhere in the global place of your app (for example in app.ts):
import "reflect-metadata";
- You may need to install node typings:
npm install @types/node --save
-
Install a database driver:
- for MySQL or MariaDB
npm install mysql --save (you can install mysql2 instead as well)
* for **PostgreSQL** or **CockroachDB**
npm install pg --save
* for **SQLite**
npm install sqlite3 --save
* for **Microsoft SQL Server**
npm install mssql --save
* for **sql.js**
npm install sql.js --save
* for **Oracle**
npm install oracledb --save
Install only one of them, depending on which database you use.
To make the Oracle driver work, you need to follow the installation instructions from their site.
* for **MongoDB** (experimental)
npm install mongodb --save
* for **NativeScript** , **react-native** and **Cordova**
Check documentation of supported platforms
TypeScript configuration
Also, make sure you are using TypeScript compiler version 3.3 or greater,and you have enabled the following settings in tsconfig.json:
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
You may also need to enable es6 in the lib section of compiler options, or install es6-shim from @types.
