Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sa2taka opened this issue Mar 8, 2024 · 3 comments
Closed

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

sa2taka opened this issue Mar 8, 2024 · 3 comments

Comments

@sa2taka
Copy link

sa2taka commented Mar 8, 2024

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.

@sa2taka sa2taka changed the title [Bug]: Runtime error when using "-p" option [Bug]: Runtime error occurred when using "-p" option Mar 8, 2024
@sa2taka sa2taka changed the title [Bug]: Runtime error occurred when using "-p" option [Bug]: Runtime error when using "-p" option Mar 8, 2024
@sa2taka sa2taka changed the title [Bug]: Runtime error when using "-p" option [Bug]Runtime error when using "-p" option Mar 8, 2024
@leethree
Copy link

leethree commented Mar 8, 2024

I'm also seeing this since 7.4.0

@Swivelgames
Copy link
Contributor

Weird! That must have been the linter. I believe I had that as a let before o.o

I haven't checked to see if a PR was pushed up to fix it yet, but if not, I'll push up and additional PR to fix asap.

@entropitor
Copy link
Owner

entropitor commented Mar 9, 2024

https://github.com/entropitor/dotenv-cli/releases/tag/v7.4.1

e794d3e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants