”;
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.
Install TypeORM
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 −
+ [email protected] + 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 −
+ [email protected] 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/[email protected] added 1 package and audited 1236 packages in 2.167s
Install database driver
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 −
+ [email protected] 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 −
+ [email protected] 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 −
+ [email protected] 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,
+ [email protected] 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 −
+ [email protected] 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 −
+ [email protected] 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 −
+ [email protected] added 1 package and audited 1655 packages in 3.716s
”;