[GH-ISSUE #4072] Don't exist a file .env in the root directory - Failed build #1455

Open
opened 2026-03-16 20:23:26 +03:00 by kerem · 1 comment
Owner

Originally created by @monique77 on GitHub (May 18, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4072

Hello, please I need help.

In the root directory has a file .env.example, if I execute docker-compose up -d, it isn't possible to find the file .env

root@monique-martins:/home/monique/Downloads/hoppscotch/hoppscotch-main# docker-compose up -d
ERROR: Couldn't find env file: /home/monique/Downloads/hoppscotch/hoppscotch-main/.env

So, I renamed a file from .env_example to .env and executed the command docker-compose up -d, but it wasn't possible to find a file .env_example. But the project has only one file named .env_example in the root directory.

Follow the log

@hoppscotch/selfhost-web@2024.3.3 generate /usr/src/app/packages/hoppscotch-selfhost-web

pnpm run build

@hoppscotch/selfhost-web@2024.3.3 build /usr/src/app/packages/hoppscotch-selfhost-web
node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build

failed to load config from /usr/src/app/packages/hoppscotch-selfhost-web/vite.config.ts
error during build:
ReferenceError: [import-meta-env] failed to load file content from "/usr/src/app/.env.example".
at resolveEnvExampleKeys (/usr/src/app/node_modules/.pnpm/@import-meta-env+unplugin@0.4.10_@import-meta-env+cli@0.6.3_dotenv@16.3.1/node_modules/@import-meta-env/unplugin/dist/index.js:111:11)
at /usr/src/app/node_modules/.pnpm/@import-meta-env+unplugin@0.4.10_@import-meta-env+cli@0.6.3_dotenv@16.3.1/node_modules/@import-meta-env/unplugin/dist/index.js:1445:26
at Object. (/usr/src/app/node_modules/.pnpm/unplugin@1.5.1/node_modules/unplugin/dist/index.js:1503:32)
at file:///usr/src/app/packages/hoppscotch-selfhost-web/vite.config.ts.timestamp-1716071155200-3b27aebf9a492.mjs:380:56
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async loadConfigFromBundledFile (file:///usr/src/app/node_modules/.pnpm/vite@4.5.0_@types+node@18.18.8_sass@1.69.5_terser@5.27.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:66322:21)
at async loadConfigFromFile (file:///usr/src/app/node_modules/.pnpm/vite@4.5.0_@types+node@18.18.8_sass@1.69.5_terser@5.27.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:66171:28)
at async resolveConfig (file:///usr/src/app/node_modules/.pnpm/vite@4.5.0_@types+node@18.18.8_sass@1.69.5_terser@5.27.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:65767:28)
at async build (file:///usr/src/app/node_modules/.pnpm/vite@4.5.0_@types+node@18.18.8_sass@1.69.5_terser@5.27.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:47926:20)
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
The command '/bin/sh -c pnpm run generate' returned a non-zero code: 1
ERROR: Service 'hoppscotch-aio' failed to build : Build failed

Originally created by @monique77 on GitHub (May 18, 2024). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4072 Hello, please I need help. In the root directory has a file .env.example, if I execute docker-compose up -d, it isn't possible to find the file .env root@monique-martins:/home/monique/Downloads/hoppscotch/hoppscotch-main# docker-compose up -d ERROR: Couldn't find env file: /home/monique/Downloads/hoppscotch/hoppscotch-main/.env So, I renamed a file from .env_example to .env and executed the command docker-compose up -d, but it wasn't possible to find a file .env_example. But the project has only one file named .env_example in the root directory. Follow the log @hoppscotch/selfhost-web@2024.3.3 generate /usr/src/app/packages/hoppscotch-selfhost-web > pnpm run build > @hoppscotch/selfhost-web@2024.3.3 build /usr/src/app/packages/hoppscotch-selfhost-web > node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build failed to load config from /usr/src/app/packages/hoppscotch-selfhost-web/vite.config.ts error during build: ReferenceError: [import-meta-env] failed to load file content from "/usr/src/app/.env.example". at resolveEnvExampleKeys (/usr/src/app/node_modules/.pnpm/@import-meta-env+unplugin@0.4.10_@import-meta-env+cli@0.6.3_dotenv@16.3.1/node_modules/@import-meta-env/unplugin/dist/index.js:111:11) at /usr/src/app/node_modules/.pnpm/@import-meta-env+unplugin@0.4.10_@import-meta-env+cli@0.6.3_dotenv@16.3.1/node_modules/@import-meta-env/unplugin/dist/index.js:1445:26 at Object.<anonymous> (/usr/src/app/node_modules/.pnpm/unplugin@1.5.1/node_modules/unplugin/dist/index.js:1503:32) at file:///usr/src/app/packages/hoppscotch-selfhost-web/vite.config.ts.timestamp-1716071155200-3b27aebf9a492.mjs:380:56 at ModuleJob.run (node:internal/modules/esm/module_job:222:25) at async ModuleLoader.import (node:internal/modules/esm/loader:316:24) at async loadConfigFromBundledFile (file:///usr/src/app/node_modules/.pnpm/vite@4.5.0_@types+node@18.18.8_sass@1.69.5_terser@5.27.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:66322:21) at async loadConfigFromFile (file:///usr/src/app/node_modules/.pnpm/vite@4.5.0_@types+node@18.18.8_sass@1.69.5_terser@5.27.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:66171:28) at async resolveConfig (file:///usr/src/app/node_modules/.pnpm/vite@4.5.0_@types+node@18.18.8_sass@1.69.5_terser@5.27.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:65767:28) at async build (file:///usr/src/app/node_modules/.pnpm/vite@4.5.0_@types+node@18.18.8_sass@1.69.5_terser@5.27.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:47926:20)  ELIFECYCLE  Command failed with exit code 1.  ELIFECYCLE  Command failed with exit code 1. The command '/bin/sh -c pnpm run generate' returned a non-zero code: 1 ERROR: Service 'hoppscotch-aio' failed to build : Build failed
Author
Owner

@Leon-Luu commented on GitHub (May 22, 2024):

Hello
You should be able to build with just copy from .env to .env.example without deleting the .env.example

<!-- gh-comment-id:2124531581 --> @Leon-Luu commented on GitHub (May 22, 2024): Hello You should be able to build with just copy from .env to .env.example without deleting the .env.example
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1455
No description provided.