Here is my process:
- First, I installed MongoDB
- Next, I opened Visual Studio 2015
- Then, I created a new project by going to "File" -> "New" -> "Project" -> "TypeScript" -> "Blank Node.js Console Application"
- After that, I opened the project folder in console as an administrator and entered the following commands: npm install --save mongodb npm install --save-dev @types/mongodb
- When I build the project in Visual Studio, I encountered the following error messages:
Error Build:Subsequent variable declarations must have the same type. Variable 'main' must be of type 'any', but here has type 'NodeModule'. MongodbExp E:_Projects\TypeScript\MongoDB\MongodbExp\node_modules\@types\node\index.d.ts 91
Error Build:Subsequent variable declarations must have the same type. Variable 'parent' must be of type 'any', but here has type 'NodeModule'. MongodbExp E:_Projects\TypeScript\MongoDB\MongodbExp\node_modules\@types\node\index.d.ts 102
Error Build:Subsequent variable declarations must have the same type. Variable 'children' must be of type 'any[]', but here has type 'NodeModule[]'. MongodbExp E:_Projects\TypeScript\MongoDB\MongodbExp\node_modules\@types\node\index.d.ts 103
Error Build:Duplicate identifier 'BufferEncoding'. MongodbExp E:_Projects\TypeScript\MongoDB\MongodbExp\node_modules\@types\node\index.d.ts 123
and so forth
Lastly, here is the content of my package.json file:
{
"name": "mongodb-exp",
"version": "0.0.0",
"description": "MongodbExp",
"main": "app.js",
"author": {
"name": "8Observer8"
},
"dependencies": {
"mongodb": "^2.2.30"
},
"devDependencies": {
"@types/mongodb": "^2.2.7",
"typescript": "^2.4.2"
}
}