Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
La fuente Node.js dotenv no devuelve nada

Tengo un proyecto de nodo, con index.js y .env en la misma carpeta.

index.js se ve así:

 console.log(require("dotenv").config()) console.log(process.env.TIMES)

.env se ve así: TIMES=2

En esta carpeta en powershell, ejecuto node index.js . Ya he instalado dotenv y tal. Obtengo el siguiente resultado:

 { parsed: {} } undefined

No puedo obtener mis variables de entorno. ¿Qué estoy haciendo mal?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Tienes que definir require("dotenv").config() fuera de console.log

 require("dotenv").config() console.log(process.env.TIMES)
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!