Search code examples
ubuntudotenv

Problems requiring environment variables in ubuntu environment


I am developing nodejs in ubuntu. In the development environment, environment variables are read well from the .env file. In ubuntu production, only undefined is shown.

When I required the library, I wrote dotenv npm usage as shown below:

require ('dotenv'). config ()

Please let me know if you have any options that I do not know when requesting a library.


Solution

  • When copying and pasting locally from the instance to the Ubuntu environment, make sure that the string is truncated.

    The first three characters are probably truncated.