I want to remove a value from process.env
:
process.env.VALUE_I_WANT_REMOVED = undefined;
But when I do this, process.env.VALUE_I_WANT_REMOVED
is set to the string "undefined"
, not to the value undefined
.
How do I actually remove the value from process.env
?
Try this:
delete process.env.VALUE_I_WANT_DELETED;
According to the Node.js documentation:
Assigning a property on
process.env
will implicitly convert the value to a string.Example:
process.env.test = null; console.log(process.env.test); // => 'null' process.env.test = undefined; console.log(process.env.test); // => 'undefined'
Use
delete
to delete a property fromprocess.env
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With