Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
0 answers
44 views

env variables give undefined in production server in node js

I am working on a Node.js project that works perfectly on both my local and development servers. However, after moving the project to a live server, I am encountering an issue where environment ...
Smith's user avatar
  • 11
1 vote
2 answers
2k views

Trying to load .env file into to pm2 config - getting error

I have followed every example I can find online and cannot get my pm2 config to correctly load my Node server. I keep getting the error: Error: Cannot find module 'dotenv/config' . I have my .env in ...
dmikester1's user avatar
  • 1,402
0 votes
0 answers
108 views

pm2 node module is not reading any environment variable from current bash instance

I am trying to run my express application using the pm2 module. The module works fine but all the environment variables defined in the bash session are not defined in the server initiated by pm2. If I ...
Hossam Hamza's user avatar
0 votes
1 answer
566 views

PM2 - problem with the initialization of variables

Is it possible to initialize the environment variables and start the process after the defined time ? Because, at the first start, the process choose the environment by default I tried to define the ...
Bryan Kwuimo's user avatar
0 votes
1 answer
287 views

Deploying Multiple NodeJS Servers on a Single DigitalOcean Droplet; Managed by PM2, Without Using an ecosystem.config.js file

Firtly, my servers are nginx-based and certified by certbot - let's encrypt. Hence, I'm assuming you're acquainted with this setup. Now, unto the epicenter of our problem. A major problem using the ...
Chukwunazaekpere's user avatar
1 vote
0 answers
637 views

Docker: cant access env variables inside pm2 nodejs code

So I am facing a weird problem. I am starting a docker container with a entrypoint file and a env variable edgeboxId. The entrypoint.sh contains some pm2 commands to start my nodejs application. ...
Anudocs's user avatar
  • 686
2 votes
1 answer
289 views

how to pass custom args to pm2

these are my scripts: "scripts": { "dev": "NODE_ENV=development nodemon -r dotenv/config index.js dotenv_config_path=../../dev.env", "start": "...
ShaSha's user avatar
  • 699
2 votes
1 answer
431 views

PM2 is not able to get updated value set in ~/.profile file

I have set environment variables in ~/.profile file as export $VAR="Value" If I change the values, Node application is not able to read updated value. This problem persists only if node ...
Krunal Sonparate's user avatar
0 votes
0 answers
129 views

How to configure PM2 to start certain applications based on the system's environment variables?

I went through the PM2 documentation and it looks like it provides the facility to send environment variables to your application but I could not find any information on how to configure PM2 such that ...
Anish Sana's user avatar
3 votes
2 answers
2k views

PM2 Cluster Mode - Cannot find module 'dotenv/config'

I am trying to run multiple apps using PM2 in cluster mode with config file given below: "apps": [ { "name": "Node APIs", "script": "./server", "watch":...
idrisjafer's user avatar
1 vote
1 answer
2k views

PM2 ecosystem.config.js nested environment variables

I have an env variable in my ecosystem.config.js like this ORGANIZATION: { "b0fd9120-deb7-55t6-b269-c1622a43e9af": { ORG_NAME: "org 1", ...
Tridev Mishra's user avatar
0 votes
1 answer
803 views

Is there a way to pass PM2 cluster instance ID to a compiled webpack node.js server?

I'm trying to figure out, if there's a way to pass the PM2 cluster mode instance ID to a, compiled with webpack, node.js server. I want to write to different folders depending on the cluster id. I've ...
Buzzkill's user avatar
0 votes
1 answer
511 views

How to pass pm2 env variables into the node repl?

Imagine that I have some pm2 configuration file with some env variables into it: "env" : { "NODE_ENV": "development", "MONGO_ENABLED" : true, "MONGO_URI": "mongodb://localhost:27017/...
Sergey Potekhin's user avatar
1 vote
1 answer
19k views

Define PM2 script path with environment variable

I'm building a simple staging CI environment where I define the path of the runnable Node application by an environment variable APP_PATH. Is it possible to tell PM2 in a process config file to look ...
bearlysophisticated's user avatar
2 votes
0 answers
316 views

Angular2 - read environment variable from PM2

My Angular2 app is running inside NodeJS app (something like MEAN app), which is started by PM2. I have set an environment variable in my PM2 configuration which I can access from the NodeJS app with ...
Radoslav Stoyanov's user avatar

15 30 50 per page