Try to search your question here, if you can't find : Ask Any Question Now ?

Mongo DB driver "Cannot find module 'bson'." and no intellisense

HomeCategory: stackoverflowMongo DB driver "Cannot find module 'bson'." and no intellisense
gaurav asked 2 weeks ago

I’m setting up a server, and want to use Mongo DB as my Data storage but I am not getting any intellisence from Visual Studio Code whatsoever and adding and removing flow. When I “CTRL + Click” MongoClient I get 2 same errors i.e. Cannot find module ‘bson’. when I hover over bson
it shows the location to AppData/Local/Microsoft/TypeScript/3.4/node_modules/@types/bson/index
could not find module bson on line :

   `import { ObjectID, Timestamp } from 'bson';`

and line”
export { Binary, DBRef, Decimal128, Double, Long, MaxKey, MinKey, ObjectID, ObjectId, Timestamp } from 'bson';

What I’ve tried is installing mode and various npm packages you’ll see from my package.json file and running npm install, npm update and installing node – gyp for global but still the error has persisted

package.json

{
  "name": "MadLibs_SERVER",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo "Error: no test specified" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@types/bson": "^4.0.0",
    "@types/mongodb": "^3.1.22",
    "@types/node": "^11.13.0",
    "bson": "^4.0.2",
    "express": "^4.16.4",
    "mongodb": "^3.2.3",
    "node": "^11.13.0"
  }
}
1 Answers
Best Answer
Fernando answered 2 weeks ago
Your Answer

3 + 18 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com