question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when using -f *.js file

See original GitHub issue

What am I missing?

This is the error:

Error: Failed to find .env file at path: ./ignore/env.js
    at getEnvFile (.../xxxxx/node_modules/env-cmd/dist/get-env-vars.js:40:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

package.json script:

"scripts": {
    "start": "env-cmd -f ./ignore/env.js node ./dist/index.js"
}

env.js content:

module.exports = {
        EXTERNAL_ADD: true,
        INTERNAL_ADD: true,
        EXECUTIONS: "invisible"
}

Also tried using Promise.resolve

module.exports = Promise.resolve ({
        EXTERNAL_ADD: true,
        INTERNAL_ADD: true,
        EXECUTIONS: "invisible"
})

Tried using full path and still the same error.

OS: Mac env-cmd: “^10.1.0” Node: v10.22.1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
toddbluhmcommented, Dec 17, 2020

Hey everyone, sorry for not being around lately. I have been super busy working on a new/young startup with little free time to spare as well as migrating ts-standard over to the actual standard org.

However, I have nearly completed the next major iteration of this project. It will bring a lot of simplification, it will do a lot more “auto-discovery” of env files, as well as easy expandability using different file formats (I already have support for sync/async js/json/json5/yaml/toml/mjs/.env and maybe ts as well…still investigating) and maybe even env expansion within each env file (TBD). I have been reviewing each feature request/issue in github and would like to tackle everything I can before the release.

I have already fixed the error message stuff that is being discussed here as well. I apologize for my absence, but my day job has to come first for my family’s sake.

0reactions
marnixhohcommented, Dec 18, 2020

Thanks @toddbluhm !!

Read more comments on GitHub >

github_iconTop Results From Across the Web

why is the browser shows me file not found error when i try to ...
this will look like <script type="text/javascript" src='C:\User\ (navigate through your files and folders to get to sign-up.js)'></script> This ...
Read more >
Control flow and error handling - JavaScript - MDN Web Docs
If an exception is thrown while the file is open, the finally block closes the file before the script fails. Using finally here...
Read more >
Documentation - Type Checking JavaScript Files - TypeScript
js file are considered optional. Calls with fewer arguments than the declared number of parameters are allowed. It is important to note that...
Read more >
The 10 Most Common JavaScript Issues Developers Face
As explained in our JavaScript Hiring Guide, “strict mode” (i.e., including 'use strict'; at the beginning of your JavaScript source files) is a...
Read more >
Error Editing .js Files in Windows - AllWebCo Templates
Support for problems editing .js files in Windows. The .js files on your computer may be associated with another application or may have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found