1
I did the installation of 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:
The file was imported with require()
:
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 in the project. Am I calling the module wrong? Why can’t Node locate the module?
Are you sure that Environment is set to dev?
– Francisco
Where do I see it?
– Mr Genesis
Hello, you installed the module in the directory
C:\Users\mrgen\OneDrive>
right, but in the stack he points out that you are in this directoryC:\Users\mrgen\OneDrive\cursos\javascript\pesquisas\cadastro\src\index.js
, it is good to check the directories in question– MSLacerda
um... I decreased the size of the directory to get cleaner (formatted), but it’s all in C: Users mrgen Onedrive courses javascript research register. But I just edited out the question.
– Mr Genesis
Try to install project dependencies, that must be it. Can be with the Yarn command
– Henrique Lati