Questions tagged [dotenv]

This tag is for questions about the Dotenv Node.js module. For PHP, see the `phpdotenv` tag; for ruby, see the `ruby-dotenv` tag.

Dotenv is a zero-dependency Node.js module that loads environment variables from a .env file into process.env. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology.

Find NPM package here for documentaion.

Other language implementations

821 questions
-1
votes
1 answer

How to make Dotenv and Nock work together?

Currently in one of my apps i am using nock to mock my api request.Unfortunately in another test file of same project, i used dotenv.If i use dotenv my nock is not mocking the url, it is using the original api request. Any suggestions or help is…
-1
votes
1 answer

node.js dotenv load is not a function

i just updated my packages and im unable to load in my env file using the npm dotenv package. "dotenv": "^7.0.0", "@types/dotenv": "^6.1.0", import dotenv from "dotenv"; switch (process.env.NODE_ENV) { case "test": …
Kay
  • 17,906
  • 63
  • 162
  • 270
-1
votes
1 answer

HTML form data not being sent in Heroku. ENV variable issue

so at the risk of getting more down votes, here goes my question (be nice!): Ive spent hours trying to figure out how to get Heroku to accept the ENV Variables I have just added through (heroku config:set PASS_CODE='password'). I have a simple HTML…
sdawes
  • 631
  • 1
  • 7
  • 15
-2
votes
1 answer

why do I keep getting TypeErrors whenever I run the discord bot code?

whenever I type into the terminal node install index.js it either shows up as TypeError [ClientMissingIntents]: Valid intents must be provided for the Client, or TypeError: Cannot read properties of undefined (reading 'FLAGS'). I've already…
-2
votes
1 answer

Environment variable not available in a route while using NodeJS + Express and testing with Jest + Supertest

I am using dotenv to load an environment variable which is intended to be an API Token. All requests made to this API are valid only if they carry this token in a header. I've already tried using: require("dotenv").config(); in my app.js file and…
Ed de Almeida
  • 3,675
  • 4
  • 25
  • 57
-2
votes
1 answer

ReferenceError: window || document undefined

I have been playing about with public API's & the data is fetched and DOM is executed but i'm at a loss when i use an environment variable to hide the API_KEY by importing the dotenv module. Then i get either window or document is not defined…
bpkush
  • 1
  • 1
-2
votes
1 answer

dotenv module not working like before in a react app

I created a new react projet and then I added dotenv. require('dotenv').config(); but I got this: {{{ ERROR in ./node_modules/dotenv/lib/main.js 1:11-24 Module not found: Error: Can't resolve 'fs' in…
Zakaria Aarab
  • 11
  • 1
  • 6
-2
votes
1 answer

How to store encryption key on DOTENV file?

So I made a program that encrypts a given string , The encryption is simple storing ASCII characters value from 32 to 126 in DOTENV file , one being a normal string storing values from 32 to 126 and other string storing a shuffled value of the…
ZeyoYT
  • 11
  • 3
-3
votes
1 answer

Can't get .env variables to update Nodejs express

I cannot get my .env file to update which only contains the following variable: DB_URI=mongodb+srv://user:pw@cluster1.jz57tt3.mongodb.net/?retryWrites=true&w=majority I am attempting to switch to a new mongodb cluster by updating the DB_URI…
Mike
  • 1
  • 2
-3
votes
1 answer

access environment variables in Python inside many files

if i need to get the value of an environment variables inside many files in the project Python (flask framework) should i use os.environ['HOME'] for every use or there is better way? for example: auth\routes.py username=…
avtar550
  • 51
  • 1
  • 2
  • 8
-3
votes
1 answer

Ubuntu, NodeJs and environment file

I have an issue with my NodeJS myApp1 and loading of its .ENV file (https://www.npmjs.com/package/dotenv). When I execute it like below - it loads partially my params inside my .ENV file root@Monster:/# node…
PabloDK
  • 2,181
  • 2
  • 19
  • 42
1 2 3
54
55