Socket
Socket
Sign inDemoInstall

dotenv

Package Overview
Dependencies
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv - npm Package Compare versions

Comparing version 14.0.0 to 14.0.1

10

CHANGELOG.md

@@ -7,2 +7,8 @@ # Changelog

## [14.0.1](https://github.com/motdotla/dotenv/compare/v14.0.0...v14.0.1) (2022-01-16)
### Added
- Log error on failure to load `.env` file ([#594](https://github.com/motdotla/dotenv/pull/594))
## [14.0.0](https://github.com/motdotla/dotenv/compare/v13.0.1...v14.0.0) (2022-01-16)

@@ -12,3 +18,3 @@

- Support inline comments for the parser 🎉 ([#568](https://github.com/motdotla/dotenv/pull/568))
- _Breaking:_ Support inline comments for the parser 🎉 ([#568](https://github.com/motdotla/dotenv/pull/568))

@@ -25,3 +31,3 @@ ## [13.0.1](https://github.com/motdotla/dotenv/compare/v13.0.0...v13.0.1) (2022-01-16)

* Add type file for `config.js` ([#539](https://github.com/motdotla/dotenv/pull/539))
* _Breaking:_ Add type file for `config.js` ([#539](https://github.com/motdotla/dotenv/pull/539))

@@ -28,0 +34,0 @@ ## [12.0.4](https://github.com/motdotla/dotenv/compare/v12.0.3...v12.0.4) (2022-01-16)

6

lib/main.js

@@ -51,3 +51,3 @@ const fs = require('fs')

if (trimmedLine.length && trimmedLine[0] !== '#') {
log(`failed to match key and value when parsing line ${idx + 1}: ${line}`)
log(`Failed to match key and value when parsing line ${idx + 1}: ${line}`)
}

@@ -93,2 +93,6 @@ }

} catch (e) {
if (debug) {
log(`Failed to load ${dotenvPath} ${e.message}`)
}
return { error: e }

@@ -95,0 +99,0 @@ }

{
"name": "dotenv",
"version": "14.0.0",
"version": "14.0.1",
"description": "Loads environment variables from .env file",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

@@ -49,4 +49,3 @@ <p align="center">

// index.js
const dotenv = require('dotenv')
dotenv.config()
require('dotenv').config()

@@ -69,4 +68,3 @@ console.log(process.env) // remove this after you've confirmed it working

```javascript
var dotenv = require('dotenv')
dotenv.config()
require('dotenv').config()

@@ -214,2 +212,14 @@ ...

### Why is the `.env` file not loading my environment variables successfully?
Most likely your `.env` file is not in the correct place. [See this stack overflow](https://stackoverflow.com/questions/42335016/dotenv-file-is-not-loading-environment-variables).
Turn on debug mode and try again..
```js
require('dotenv').config({ debug: true })
```
You will receive a helpful error outputted to your console.
### Should I commit my `.env` file?

@@ -216,0 +226,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc