This chapter explains about how to install TypeORM on your machine. Before moving to installation, please make sure that npm is installed. To confirm that you have npm, you can run the following command in your terminal.
npm -v
It shows the version. If it is not installed, download the latest version and install on your machine.
Let us install TypeORM locally using npm module −
npm install typeorm --save
After executing the above command, you will get a response as given below −
+ typeorm@0.2.24 + added 1 package and audited 1236 packages in 4.729s
Alternatively, to install TypeORM globally, use the below command −
npm install typeorm -g
After that, install optional package reflect-metadata using npm −
npm install reflect-metadata --save
You could see the following response −
+ reflect-metadata@0.1.13 added 1 package and audited 1236 packages in 2.426s
Now, install another optional package. node typings using the below command −
npm install @types/node --save
You could see the following response −
+ @types/node@12.12.31 added 1 package and audited 1236 packages in 2.167s
In this section, let us install the necessary node packages for our database.
To install MySQL or MariaDB package, use the below command −
npm install mysql --save
You could see the following response −
+ mysql@2.18.1 added 1 package and audited 1236 packages in 4.36s
To install PostgreSQL package, use the below command −
npm install pg --save
You could see the following response −
+ pg@7.18.2 added 1 package and audited 1236 packages in 2.863s
To install SQLite package, use the below command −
npm install sqlite3 --save
You could see the following response −
+ sqlite3@4.1.1 added 48 packages from 45 contributors and audited 1396 packages in 7.31s
To install Microsoft SQL Server package, use the below command −
npm install mssql --save
Your screen looks similar to this,
+ mssql@6.2.0 added 1 package and audited 1655 packages in 2.378s
To install sql.js package, use the below command −
npm install sql.js --save
You could see the following response −
+ sql.js@1.2.1 added 1 package and audited 1655 packages in 6.462s
To install Oracle server package, use the below command −
npm install oracledb --save
You could see the following response −
+ oracledb@4.2.0 added 1 package and audited 1655 packages in 2.265s
To install mongodb package, use the below command −
npm install mongodb --save
You could see the following response −
+ mongodb@3.5.5 added 1 package and audited 1655 packages in 3.716s