Is there any way for node.js to know the actual path of the module referenced by the lock?

for example, a koa package is referenced in Node.js:

const Koa = require("koa")

because Node.js automatically looks in the node_modules of the current directory when it loads a package without a path. If you can"t find it, you"ll look for it at the top. With this flat structure, it"s not easy for me to know which layer Node loaded the package from.

is there any way to print the path of the current package load in the code?

Apr.07,2021

require.resolve () ,
read more documents

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e22f-e93c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e22f-e93c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?