[GH-ISSUE #5115] [BUG]: yarn setup fails if any .env file already exists #4925

Closed
opened 2026-06-05 14:50:55 -04:00 by yindo · 1 comment
Owner

Originally created by @brianpursley on GitHub (Mar 2, 2026).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5115

How are you running AnythingLLM?

Local development

What happened?

There is no way to run or re-run the yarn setup command if one of your .env files already exists, and the error message isn't very helpful to understand why it failed.

~/projects/anything-llm (master) % yarn setup
yarn run v1.22.22
(node:42116) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)
$ cd server && yarn && cd ../collector && yarn && cd ../frontend && yarn && cd .. && yarn setup:envs && yarn prisma:setup && echo "Please run yarn dev:server, yarn dev:collector, and yarn dev:frontend in separate terminal tabs."
(node:42118) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
warning Resolution field "form-data@4.0.4" is incompatible with requested version "form-data@4.0.0"
warning Resolution field "form-data@4.0.4" is incompatible with requested version "form-data@4.0.0"
success Already up-to-date.
(node:42119) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
success Already up-to-date.
(node:42120) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)
[1/4] 🔍  Resolving packages...
success Already up-to-date.
(node:42121) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)
$ cp -n ./frontend/.env.example ./frontend/.env && cp -n ./server/.env.example ./server/.env.development && cp -n ./collector/.env.example ./collector/.env && cp -n ./docker/.env.example ./docker/.env && echo "All ENV files copied!
"
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Cause:
cp -n exits with code 1 if the destination file already exists. The setup:envs script uses && which short-circuits on a non-zero exit code, causing setup:envs to fail and then yarn setup to fail.

(Platform: MacOS, but I'm guessing also other platforms)

Are there known steps to reproduce?

Manually create one of the .env files and then run yarn setup.

Or just to run yarn setup twice. It will fail on the second run because the .env files already exist.

Originally created by @brianpursley on GitHub (Mar 2, 2026). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5115 ### How are you running AnythingLLM? Local development ### What happened? There is no way to run or re-run the `yarn setup` command if one of your .env files already exists, and the error message isn't very helpful to understand why it failed. ``` ~/projects/anything-llm (master) % yarn setup yarn run v1.22.22 (node:42116) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities. (Use `node --trace-deprecation ...` to show where the warning was created) $ cd server && yarn && cd ../collector && yarn && cd ../frontend && yarn && cd .. && yarn setup:envs && yarn prisma:setup && echo "Please run yarn dev:server, yarn dev:collector, and yarn dev:frontend in separate terminal tabs." (node:42118) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities. (Use `node --trace-deprecation ...` to show where the warning was created) [1/5] 🔍 Validating package.json... [2/5] 🔍 Resolving packages... warning Resolution field "form-data@4.0.4" is incompatible with requested version "form-data@4.0.0" warning Resolution field "form-data@4.0.4" is incompatible with requested version "form-data@4.0.0" success Already up-to-date. (node:42119) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities. (Use `node --trace-deprecation ...` to show where the warning was created) [1/5] 🔍 Validating package.json... [2/5] 🔍 Resolving packages... success Already up-to-date. (node:42120) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities. (Use `node --trace-deprecation ...` to show where the warning was created) [1/4] 🔍 Resolving packages... success Already up-to-date. (node:42121) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities. (Use `node --trace-deprecation ...` to show where the warning was created) $ cp -n ./frontend/.env.example ./frontend/.env && cp -n ./server/.env.example ./server/.env.development && cp -n ./collector/.env.example ./collector/.env && cp -n ./docker/.env.example ./docker/.env && echo "All ENV files copied! " error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ``` Cause: `cp -n` exits with code 1 if the destination file already exists. The [`setup:envs`](https://github.com/Mintplex-Labs/anything-llm/blob/e145c391e986bfdde82da098450f09da56ba7bf5/package.json#L24) script uses `&&` which short-circuits on a non-zero exit code, causing `setup:envs` to fail and then `yarn setup` to fail. (Platform: MacOS, but I'm guessing also other platforms) ### Are there known steps to reproduce? Manually create one of the .env files and then run `yarn setup`. Or just to run `yarn setup` twice. It will fail on the second run because the .env files already exist.
yindo added the possible bug label 2026-06-05 14:50:55 -04:00
yindo closed this issue 2026-06-05 14:50:55 -04:00
Author
Owner

@brianpursley commented on GitHub (Mar 2, 2026):

I left a pr, but I don't know, maybe it is intentional to fail if any env file exists already.

<!-- gh-comment-id:3988265161 --> @brianpursley commented on GitHub (Mar 2, 2026): I left a pr, but I don't know, maybe it is intentional to fail if any env file exists already.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4925