# Develop

## Windows: “The process … not found” / taskkill errors

When you run `npm run dev` (Medusa’s file watcher) and change a file under `src/`, the watcher may try to restart the server and fail with:

- **ERROR: The process "…" not found**
- `Error: Command failed: taskkill /PID … /F /T`

This happens because Medusa’s develop command restarts by killing a child process by PID; on Windows that process can already be gone, so `taskkill` fails and the watcher crashes.

**Options:**

1. **Use the nodemon-based watcher (recommended on Windows)**  
   Run:
   ```bash
   npm run dev:watch
   ```
   This watches `src/` and runs `medusa build && medusa start` on changes. Restarts are handled by nodemon, so you avoid the taskkill error.

2. **No file watching**  
   Run:
   ```bash
   npm run dev:no-watch
   ```
   Restart manually (Ctrl+C, then run again) after code changes.

3. **Keep using `npm run dev`**  
   If the watcher breaks, stop the server (Ctrl+C) and run `npm run dev` again.

---

## Admin login: GET /admin/users/me 401 (Unauthorized)

If login succeeds (POST /auth/session returns 200) but `/admin/users/me` still returns 401, the session cookie is not being sent or accepted.

**Config (already applied):**
- `medusa-config.ts`: `cookieOptions` with `path: "/"`, `sameSite: "lax"`, `secure: false` so the session cookie works over HTTP on localhost.
- `.env`: `MEDUSA_ADMIN_BACKEND_URL=http://localhost:9000`.

**What to do:**
1. Restart the server (Ctrl+C, then `npm run start`) so the config is loaded.
2. Use the same origin for the admin: open **http://localhost:9000** (not `127.0.0.1`) so the cookie domain matches.
3. Clear site data for that origin (DevTools → Application → Storage → Clear site data), then log in again.
4. In DevTools → Application → Cookies, confirm a cookie (e.g. `connect.sid`) exists for `http://localhost:9000` with Path `/` after login.
5. If you use Redis, ensure it is running; otherwise the app uses an in-memory store and sessions can be flaky.

---

Storefront example component lives in `examples/storefront/` (not under `src/`) so the backend watcher is not triggered by it.
