Automation & Agents

Moved a Folder and Your AI Tool Can't Find Its Packages: A Full Fix Guide

You fixed every hard-coded path in your code and the service still says "package not found". The packages are all there. The real culprit is the package manager's own editable install record, which has nothing to do with the paths in your code.

08/24/2026 | 4 min read

What This Guide Gives You

After reading, you’ll know why a service reports “package not found” after you move a folder containing a Python virtual environment (venv) or a Node.js project (especially one managed with pnpm), and how to find the real cause and fix it in about 5 minutes. No code rewrite needed.

One Core Idea

An editable install records, at install time, the absolute path where the package’s source code lives. That record is separate from the paths written in your own code. Fixing every path in your code does not update it. Once the folder moves, it becomes a dead link pointing at nothing.

The signal that you’ve hit this: the service fails at startup with “package not found” or “module does not exist”, yet the package folder is clearly still on disk.

How To Do It

Step 1 | Confirm it’s this problem and not something else

Open a terminal (Command Prompt or PowerShell), take the package name from the error message, and check whether its files actually exist.

  • Python: packages usually live under your-venv-folder\Lib\site-packages\
  • Node.js: packages usually live under the project’s node_modules\

If the files are all there and you still get “not found”, this is very likely your problem.

🪄 Prompt for your AI (if you’re not sure where packages are installed or how to check)

On Windows, running [your program/service] gives this error: [paste the full error]. Walk me step by step through checking whether this package’s files actually exist on disk and which folder they should be in.

Step 2 (Python) | Find and fix the .pth file

If the project was installed with pip install -e . (development mode), look here:

your-venv-folder\Lib\site-packages\

Find files whose names contain __editable__ or _editable_impl_ (extension .pth). Open one in a plain text editor (Notepad works). It usually holds a single line: an absolute path.

Change that path by hand to the folder’s new location and save. No reinstall needed.

🪄 Prompt for your AI

I created a virtual environment on Windows with [Python version] and moved its folder from [old path] to [new path]. Walk me step by step through finding and fixing the .pth files created by editable installs (pip install -e).

If the package entries are symbolic links (filesystem-level links, not text files), a text editor can’t open or change them. This usually happens in projects managed with pnpm.

The fix is to run the install command again so the package manager rebuilds every link at the new location:

cd your-project-new-path
pnpm install --force

--force avoids an interactive confirmation prompt that would stall the process. This step does not re-download packages (they already sit in pnpm’s local shared store); it only rebuilds the links, usually within seconds to tens of seconds.

If your project uses npm or yarn instead of pnpm, the command is different.

🪄 Prompt for your AI

My Node.js project uses [pnpm / npm / yarn; if unsure, tell me whether the project folder has pnpm-lock.yaml, package-lock.json or yarn.lock]. After moving the project folder from [old path] to [new path], startup fails with [paste the full error]. Walk me step by step through reinstalling so the package links are rebuilt correctly at the new path, and explain what each command does.

This is the step people skip. Any service or program that started before the move and hasn’t been restarted since won’t notice that you fixed the files on disk. It resolved its paths when it started and keeps them in memory; editing files afterward doesn’t update it.

How to check: look for leftover old processes (Task Manager or the tasklist command on Windows), close them, then start the service again.

🪄 Prompt for your AI

On Windows I need to check whether an old process of a program (for example [program name]) is still running in the background, then close it safely and restart it. Walk me step by step through finding and closing it with Task Manager or the command line.

Step 5 | Verify for real, not just “no errors”

After restarting, don’t assume it’s fixed just because startup shows no error. Actually use a core feature once (send a real request, click the real button) and confirm you get the right result. Some failures, like a feature failing silently, never show up at startup; you only find them by using it.

Pitfalls You Will Hit

  1. The error message pushes you to reinstall. “Package not found” sounds like a broken install, but if you’ve confirmed the files exist, reinstalling usually doesn’t help (and may waste time on a download). Confirm with Step 1 first.

  2. JSON and config files can hide hard-coded absolute paths too, not just code files like .py or .js. After a move, it’s worth searching the whole project for leftover old-path strings (File Explorer search works, or ask an AI to write a one-line scan).

🪄 Prompt for your AI

Write me a command that searches every file under [your project folder] (any extension) for the old path string [old path], listing each file name and where the path appears, so I can review them one by one.

When You Get Stuck, Ask an AI

If you’re still stuck after the steps, fill in this template and paste it into an AI assistant (ChatGPT or Claude):

I'm a beginner following a guide to fix "package links broke after moving a folder". I'm at "[paste the step you're stuck on]" and I see this error/situation: "[paste the full error or describe the screen; a screenshot is fine]". My OS is Windows and the tool is [Python / Node.js, or "not sure"]. Guide me step by step, give me one action at a time, and wait for my result before telling me the next step.

One-Line Summary

After moving a folder, fixing the paths in your code and fixing the package manager’s own internal links are two separate jobs; restart your services too, and verify with real use, not just a clean startup.

Support this work:Support on Ko-fi