Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 2
Why __dirname is undefined
Hi, I am working on a nodejs website and I have added ("type": "module") in the package.json file so I can use the ES6 (from ... import ... ) syntax but when I try to console.log (__dirname) it tells me that it is *undefined* so why is that??
2 Respostas
+ 1
This might help you
https://nodejs.org/docs/latest-v12.x/api/esm.html#esm_no_node_path
+ 3
From definition
-A variable that has not been assigned a value is of typeĀ undefinedĀ .
-A method or statement also returnsĀ undefinedĀ if the variable that is being evaluated does not have an assigned value.
- A function returnsĀ undefinedĀ if a value was not returned .