Skip to content

[Bug]Runtime error when using "-p" option #106

@sa2taka

Description

@sa2taka

Info

dotenv-cli: 7.4.0

Steps to reproduce

Execute below command:

$  ENV_VALUE=dummy npx --package dotenv-cli dotenv -p ENV_VALUE

Behavior

# ENV_VALUE=dummy npx --package dotenv-cli dotenv -p ENV_VALUE
/Users/satsuta/.npm/_npx/075ae4738b5e8eb2/node_modules/dotenv-cli/cli.js:94
    value = `\`${value}\``
          ^

TypeError: Assignment to constant variable.
    at Object.<anonymous> (/Users/sa2taka/.npm/_npx/075ae4738b5e8eb2/node_modules/dotenv-cli/cli.js:94:11)

Reason

Following code seems to be attempting to overwrite the value defined by const, which seems to be causing an error.
ref: #105

const value = process.env[argv.p]
if (typeof value === 'string') {
  value = `\`${value}\``
}

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions