Unitech / Unitech/pm2

Cannot read property 'pm2_env' of undefined

Open
#5,954 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

im do custom logs

module.exports = {
    apps: [
        {
            name: 'api',
            script: './dist/main.js',
            out_file: './logs/api-out.log',
            error_file: './logs/api-error.log',
            log_date_format: 'YYYY-MM-DD HH:mm:ss',
            max_size: '10M',
            retain: '10',
            env: {
                NODE_ENV: 'production'
            }
        }, 
    ]
}

first pm2 create folder logs and running success

but if im delete folder logs im found error "Cannot read property 'pm2_env' of undefined " instead create again folder logs but im just get error dont know why. this make me confused before im just give sample my scenario.

solution

  • uninstall and install again pm2 or create again folder logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the provided PM2 ecosystem configuration: create the logs directory, run the app, remove the directory, and run PM2 again. Trace the resulting "pm2_env" error and compare it with the successful first run; done means the configured application can recover after its log directory is deleted without reinstalling PM2.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.