-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix(#355): resolve the issue of sh: dotenv: command not found #813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request addresses issue #355 by removing the dependency on the dotenv-cli package which was causing "command not found" errors. The fix simplifies the development script by relying on Next.js's native environment variable loading and adds dependency installation steps to the bootstrap script.
Changes:
- Removed
dotenv -f ../.env --from the web dev script, switching to Next.js native .env loading - Added
pnpm installcommands to bootstrap.sh for both development and production modes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| web/package.json | Simplified dev script by removing dotenv-cli wrapper, now uses plain Next.js dev command |
| bootstrap.sh | Added pnpm install before starting frontend in both dev and production modes |
| "build": "next build", | ||
| "check": "next lint && tsc --noEmit", | ||
| "dev": "dotenv -f ../.env -- next dev --turbo", | ||
| "dev": "next dev --turbo", |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of dotenv -f ../.env changes how environment variables are loaded. Previously, the dev script loaded environment variables from the parent directory's .env file. Now, Next.js will only load from .env files in the web/ directory. This could be a breaking change if users have their NEXT_PUBLIC_API_URL and other frontend environment variables in the root .env file instead of web/.env. Consider documenting this change in the PR description or adding migration instructions to help users transition their environment variable setup.
| "dev": "next dev --turbo", | |
| "dev": "dotenv -f ../.env -- next dev --turbo", |
| cd web && pnpm install && pnpm dev & WEB_PID=$$! | ||
| trap "kill $$SERVER_PID $$WEB_PID" SIGINT SIGTERM | ||
| wait | ||
| else | ||
| echo -e "Starting DeerFlow in [PRODUCTION] mode...\n" | ||
| uv run server.py & SERVER_PID=$$! | ||
| cd web && pnpm start & WEB_PID=$$! | ||
| cd web && pnpm install && pnpm start & WEB_PID=$$! |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bootstrap.bat file (Windows version) was not updated with corresponding pnpm install commands. For consistency across platforms, if you're adding pnpm install to bootstrap.sh, it should also be added to bootstrap.bat. However, consider whether running pnpm install on every startup is the right approach (see performance comments on lines 9 and 15 of bootstrap.sh).
| echo -e "Starting DeerFlow in [DEVELOPMENT] mode...\n" | ||
| uv run server.py --reload & SERVER_PID=$$! | ||
| cd web && pnpm dev & WEB_PID=$$! | ||
| cd web && pnpm install && pnpm dev & WEB_PID=$$! |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running pnpm install on every startup is inefficient and will significantly slow down the development workflow. This should only be run during initial setup or when dependencies change. Consider removing pnpm install from this startup command and only documenting it as a prerequisite step in the README or setup instructions.
| echo -e "Starting DeerFlow in [PRODUCTION] mode...\n" | ||
| uv run server.py & SERVER_PID=$$! | ||
| cd web && pnpm start & WEB_PID=$$! | ||
| cd web && pnpm install && pnpm start & WEB_PID=$$! |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running pnpm install on every startup is inefficient and will significantly slow down production deployment. This should only be run during the build/deployment phase, not at runtime. Consider removing pnpm install from this startup command and ensuring dependencies are installed as part of the deployment process.
Fixes #355 This pull request updates the development and production startup processes and simplifies the environment variable handling for the web application. The main focus is to ensure dependencies are always installed before starting the frontend and to streamline how the development server is launched.