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
Ran into the same issue, here's a snippet of gatsby-config.js I added to make the ".env.development" file visible to gatsby. (Not sure if this is the only way, node/Gatsby experts please chime in)
let activeEnv =
process.env.GATSBY_ACTIVE_ENV || process.env.NODE_ENV || "development"
console.log('Using environment config: ${activeEnv}')
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
Based on this gatsby-config.js, here is the develop script in package.json (unchanged) -
...
"develop": "gatsby develop",
...
Finally, starting the gatsby app using
npm run develop
, the logs mentions playground being available -
You can now view gatsby-starter-hello-world in the
⠀
http://localhost:8000/
⠀
View the GraphQL Playground, an in-browser IDE, to
⠀
http://localhost:8000/___graphql