I'm currently building a Node JS application using Typescript with a backing MongoDb database. But today I ran into a problem regarding import of the type definitions of MongoDb.
This line:
import { Db } from "@types/mongodb";
throws an error:
MODULE_NOT_FOUND: Cannot find module '@types/mongodb'
However the MongoDb type definitions are installed in node_modules and available in the folder @types/mongodb as can be seen here.
Visual Studio Code is not complaining compile time, but of some reason Node JS can't find the definitions runtime.
I'm quite desperate, so any hints or guidelines are highly appreciated 😊 Thanks in advance.
via Thomas Boulund
No comments:
Post a Comment