'"https" module not found in node

I'm trying to import the "https" module in node but I keep getting the Cannot find module 'https' error.

I tried using both

import https from "https"

and

const https = require("https")

but the result is the same. My understanding is that https is a core module in node so does not need to be installed separately and this is the first time I am getting this error. Any idea what might be causing it or how to get around it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source