diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a284cfe311..ef7b920948 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ Have another idea? Drop into Discord or open an issue, and let's chat! ### Prerequisites & Technology Stack - **Required Software**: - - Node.js (see `.nvmrc`, currently v24) and pnpm + - Node.js (see `.nvmrc` for the required version) and pnpm - Git for version control - A running ComfyUI backend instance (otherwise, you can use `pnpm dev:cloud`) @@ -87,6 +87,10 @@ navigate to `http://:5173` (e.g. `http://192.168.2.20:5173` here), to > ⚠️ IMPORTANT: > The dev server will NOT load JavaScript extensions from custom nodes. Only core extensions (built into the frontend) will be loaded. This is because the shim system that allows custom node JavaScript to import frontend modules only works in production builds. Python custom nodes still function normally. See [Extension Development Guide](docs/extensions/development.md) for details and workarounds. And See [Extension Overview](docs/extensions/README.md) for extensions overview. +## Troubleshooting + +If you run into issues during development (e.g. `pnpm dev` hanging, TypeScript errors after pulling, lock file conflicts), see [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for common fixes. + ## Development Workflow ### Architecture Decision Records diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md new file mode 100644 index 0000000000..b2251609b1 --- /dev/null +++ b/TROUBLESHOOTING.md @@ -0,0 +1,368 @@ +# Troubleshooting Guide + +This guide helps you resolve common issues when developing ComfyUI Frontend. + +## Quick Diagnostic Flowchart + +```mermaid +flowchart TD + A[Having Issues?] --> B{What's the problem?} + B -->|Dev server stuck| C[nx serve hangs] + B -->|Build errors| D[Check build issues] + B -->|Lint errors| Q[Check linting issues] + B -->|Dependency issues| E[Package problems] + B -->|Other| F[See FAQ below] + + Q --> R{oxlint or ESLint?} + R -->|oxlint| S[Check .oxlintrc.json
and run pnpm lint:fix] + R -->|ESLint| T[Check eslint.config.ts
and run pnpm lint:fix] + S --> L + T --> L + + C --> G{Tried quick fixes?} + G -->|No| H[Run: pnpm i] + G -->|Still stuck| I[Run: pnpm clean] + I --> J{Still stuck?} + J -->|Yes| K[Nuclear option:
pnpm dlx rimraf node_modules
&& pnpm i] + J -->|No| L[Fixed!] + H --> L + + D --> M[Run: pnpm build] + M --> N{Build succeeds?} + N -->|No| O[Check error messages
in FAQ] + N -->|Yes| L + + E --> H + + F --> P[Search FAQ or
ask in Discord] +``` + +## Frequently Asked Questions + +### Development Server Issues + +#### Q: `pnpm dev` or `nx serve` gets stuck and won't start + +**Symptoms:** + +- Command hangs on "nx serve" +- Dev server doesn't respond +- Terminal appears frozen + +**Solutions (try in order):** + +1. **First attempt - Reinstall dependencies:** + + ```bash + pnpm i + ``` + +2. **Second attempt - Clean build cache:** + + ```bash + pnpm clean + ``` + +3. **Last resort - Full node_modules reset:** + ```bash + pnpm dlx rimraf node_modules && pnpm i + ``` + +**Why this happens:** + +- Corrupted dependency cache +- Outdated lock files after branch switching +- Incomplete previous installations +- NX cache corruption + +--- + +#### Q: Port conflicts - "Address already in use" + +**Symptoms:** + +- Error: `EADDRINUSE` or "port already in use" +- Dev server fails to start + +**Solutions:** + +1. **Find and kill the process using the port:** + + ```bash + # On Linux/Mac + lsof -ti:5173 | xargs kill -9 + + # On Windows + netstat -ano | findstr :5173 + taskkill /PID /F + ``` + +2. **Use a different port** by adding a `port` option to the `server` block in `vite.config.mts`: + ```ts + server: { + port: 3000, + // ...existing config + } + ``` + +--- + +### Build and Type Issues + +#### Q: TypeScript errors after pulling latest changes + +**Symptoms:** + +- Type errors in files you didn't modify +- "Cannot find module" errors + +**Solutions:** + +1. **Rebuild TypeScript references:** + + ```bash + pnpm build + ``` + +2. **Clean and reinstall:** + + ```bash + pnpm clean && pnpm i + ``` + +3. **Restart your IDE's TypeScript server** + - VS Code: `Cmd/Ctrl + Shift + P` → "TypeScript: Restart TS Server" + +--- + +#### Q: "Workspace not found" or monorepo errors + +**Symptoms:** + +- pnpm can't find workspace packages +- Import errors between packages + +**Solutions:** + +1. **Verify you're in the project root:** + + ```bash + pwd # Should be in ComfyUI_frontend/ + ``` + +2. **Rebuild workspace:** + ```bash + pnpm install + pnpm build + ``` + +--- + +### Linting Issues (oxlint) + +#### Q: `eslint-disable` comment isn't suppressing an oxlint rule + +**Symptoms:** + +- `// eslint-disable-next-line rule-name` has no effect +- Lint error persists despite the disable comment + +**Solution:** + +oxlint has its own disable syntax. Use `oxlint-disable` instead: + +```ts +// oxlint-disable-next-line no-console +console.log('debug') +``` + +Check whether the rule is enforced by oxlint (in `.oxlintrc.json`) or ESLint (in `eslint.config.ts`) to pick the right disable comment. + +--- + +#### Q: New lint errors after pulling/upgrading oxlint + +**Symptoms:** + +- Lint errors in files you didn't change +- Rules you haven't seen before (e.g. `no-immediate-mutation`, `prefer-optional-chain`) + +**Solutions:** + +1. **Run the auto-fixer first:** + + ```bash + pnpm lint:fix + ``` + +2. **Review changes carefully** — some oxlint auto-fixes can produce incorrect code. Check the diff before committing. + +3. **If a rule seems wrong**, check `.oxlintrc.json` to see if it should be disabled or configured differently. + +**Why this happens:** oxlint version bumps often enable new rules by default. + +--- + +#### Q: oxlint fails with TypeScript errors + +**Symptoms:** + +- `pnpm oxlint` or `pnpm lint` fails with type-related errors +- Errors mention type resolution or missing type information + +**Solution:** + +oxlint runs with `--type-aware` in this project, which requires valid TypeScript compilation. Fix the TS errors first: + +```bash +pnpm typecheck # Identify TS errors +pnpm build # Or do a full build +pnpm lint # Then re-run lint +``` + +--- + +#### Q: Duplicate lint errors from both oxlint and ESLint + +**Symptoms:** + +- Same violation reported twice +- Conflicting auto-fix suggestions + +**Solution:** + +The project uses `eslint-plugin-oxlint` to automatically disable ESLint rules that oxlint already covers (see `eslint.config.ts`). If you see duplicates: + +1. Ensure `.oxlintrc.json` is up to date after adding new oxlint rules +2. Run `pnpm lint` (which runs oxlint then ESLint in sequence) rather than running them individually + +--- + +### Dependency and Package Issues + +#### Q: "Package not found" after adding a dependency + +**Symptoms:** + +- Module not found after `pnpm add` +- Import errors for newly installed packages + +**Solutions:** + +1. **Ensure you installed in the correct workspace** (see `pnpm-workspace.yaml` for available workspaces): + + ```bash + # Example: install in a specific workspace + pnpm --filter add + ``` + +2. **Clear pnpm cache:** + ```bash + pnpm store prune + pnpm install + ``` + +--- + +#### Q: Lock file conflicts after merge/rebase + +**Symptoms:** + +- Git conflicts in `pnpm-lock.yaml` +- Dependency resolution errors + +**Solutions:** + +1. **Regenerate lock file:** + + ```bash + rm pnpm-lock.yaml + pnpm install + ``` + +2. **Or accept upstream lock file:** + ```bash + git checkout --theirs pnpm-lock.yaml + pnpm install + ``` + +--- + +### Testing Issues + +#### Q: Tests fail locally but pass in CI + +**Symptoms:** + +- Flaky tests +- Different results between local and CI + +**Solutions:** + +1. **Run tests in CI mode:** + + ```bash + CI=true pnpm test:unit + ``` + +2. **Clear test cache:** + + ```bash + pnpm test:unit --no-cache + ``` + +3. **Check Node version matches CI** (see `.nvmrc` for the required version): + ```bash + node --version + nvm use # If using nvm — reads .nvmrc automatically + ``` + +--- + +### Git and Branch Issues + +#### Q: Changes from another branch appearing in my branch + +**Symptoms:** + +- Uncommitted changes not related to your work +- Dirty working directory + +**Solutions:** + +1. **Stash and reinstall:** + + ```bash + git stash + pnpm install + ``` + +2. **Check for untracked files:** + ```bash + git status + git clean -fd # Careful: removes untracked files! + ``` + +--- + +## Still Having Issues? + +1. **Search existing issues:** [GitHub Issues](https://github.com/Comfy-Org/ComfyUI_frontend/issues) +2. **Ask the community:** [Discord](https://discord.com/invite/comfyorg) (navigate to the `#dev-frontend` channel) +3. **Create a new issue:** Include: + - Your OS and Node version (`node --version`) + - Steps to reproduce + - Full error message + - What you've already tried + +## Contributing to This Guide + +Found a solution to a common problem? Please: + +1. Open a PR to add it to this guide +2. Follow the FAQ format above +3. Include the symptoms, solutions, and why it happens + +--- + +**Last Updated:** 2026-03-10 diff --git a/browser_tests/README.md b/browser_tests/README.md index 6b3c75fb9a..8158a16ce6 100644 --- a/browser_tests/README.md +++ b/browser_tests/README.md @@ -27,7 +27,7 @@ cp -r tools/devtools/* /path/to/your/ComfyUI/custom_nodes/ComfyUI_devtools/ ### Node.js & Playwright Prerequisites -Ensure you have the Node.js version from `.nvmrc` installed (currently v24). +Ensure you have the Node.js version specified in `.nvmrc` installed. Then, set up the Chromium test driver: ```bash