I installed modele
as Dev:
C:\Users\mrgen\OneDrive> npm i dotenv --save-dev
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
audited 299 packages in 3.987s
found 0 vulnerabilities
The configuration file has been updated correctly:
Thefilewasimportedwithrequire()
:
When I run the file, see what happens:
C:\Users\mrgen\OneDrive> node src/index
module.js:549
throw err;
^
Error: Cannot find module 'dotenv'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\mrgen\OneDrive\src\index.js:14:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
This does not happen if I install dotenv on the project. Am I calling the module the wrong way? Why can not the node find the module?