I have a file name .env.development in the root folder. I had install env-cmd as dev dependencies
when I start the server
> npm run develop
its give me an error
> [email protected] develop I:\learngatsby > env-cmd .env-development gatsby develop (node:1368) UnhandledPromiseRejectionWarning: Error: Unable to locate env file at default location (./.env) at I:\learngatsby\node_modules\env-cmd\dist\get-env-vars.js:44:19 at Generator.throw (<anonymous>) at rejected (I:\learngatsby\node_modules\env-cmd\dist\get-env-vars.js:5:65) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:757:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
(node:1368) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:1368) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Description. The env command allows you to display your current environment or run a specified command in a changed environment. If no flags or parameters are specified, the env command displays your current environment, showing one Name=Value pair per line.
Its environment variables file. In simple term, it is a variable text file. In this file we set a variable with value and that you wouldn't want to share with anyone, purpose of file is keep as secret and secure because in . env file we store our database password, username, API key etc…
You can set environment variable using your own custom .env
files with -f
flag with env-cmd
. Use this command to set env
variables that are defined in custom file './config/myvar.env'
.
env-cmd -f ./config/myvar.env
For more information use this link
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