env-cmd error failed to locate ./.env file in gatsby?

后端 未结 12 723
鱼传尺愫
鱼传尺愫 2020-12-15 05:33

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
         


        
12条回答
  •  遥遥无期
    2020-12-15 06:06

    You can rename .env.development to just .env and then run env-cmd gatsby develop, this will look for environment variables inside .env file.

    You can also update the develop node script inside the package.json like the following:

    "develop": "env-cmd gatsby develop"
    

    Then you can run the node script,

    npm run develop
    

    or

    gatsby develop
    

提交回复
热议问题