简体   繁体   中英

Electron app Error: ENOENT: no such file or directory, open '/.env'

I'm a really young developper, sorry if my question is obvious. I tried everything, but nothing works in my case, or maybe i'm doing it wrong.

I'm actually trying to build a React Typescript Electron App with electron-builder. When I'm starting my app localy with yarn start, everything is good, but when I'm trying to build, this issue appears.

What I understand is : my .env file isn't in my built app file. How can I tell to my builder to take into account my .env file ? Someone can help me please ? Thank you :)

Maybe this will be usefull : project files , scripts

why you need to use .env file at the first place, it wouldn't be secure cz, all of your data will be created or stored in the system. so if you want to use security credentials in electron application, you should use some cloud-based store that will provide secure access to get credentials otherwise store it in common js or JSON file. the solution is if you're using electron builder you can always use extraResources or asarUnpack .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM