How do I setup the dotenv file in Node.js?

前端 未结 30 1166

I am trying to use the dotenv NPM package and it is not working for me. I have a file config/config.js with the following content:



        
30条回答
  •  再見小時候
    2020-12-07 14:46

    If you use "firebase-functions" to host your sever-side-rendered application, you should be aware of this one:

    error: Error: ENOENT: no such file or directory, open 'C:\Codes\url_shortener\functions\.env'

    Means you have to store the .env file in the functions folder as well.

    Found this one by:

    console.log(require('dotenv').config())
    

提交回复
热议问题