Add the type property to package.json to ensure modules are supported:
{
"type": "module",
}The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.
This means you have the following choices:
import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.await import(…) from CommonJS instead of require(…).| The goal of Node was event driven HTTP servers. | |
| 5:04 https://youtu.be/M3BM9TB-8yA?t=304 | |
| 1 Regret: Not sticking with Promises. | |
| * I added promises to Node in June 2009 but foolishly removed them in February 2010. | |
| * Promises are the necessary abstraction for async/await. | |
| * It's possible unified usage of promises in Node would have sped the delivery of the eventual standartization and async/await. | |
| * Today Node's many async APIs are aging baldly due to this. | |
| 6:02 https://youtu.be/M3BM9TB-8yA?t=362 |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #include <netdb.h> | |
| #include <sys/types.h> | |
| #include <sys/socket.h> | |
| #include <arpa/inet.h> | |
| int | |
| lookup_host (const char *host) |