langgraph new ./ --template new-langgraph-project-python ❌ The specified directory…
- User
langgraph new ./ --template new-langgraph-project-python ❌ The specified directory already exists and is not empty. Aborting to prevent overwriting files.
- Assistant
The error message
❌ The specified directory already exists and is not empty. Aborting to prevent overwriting files.is very clear.The
langgraph newcommand, like many project creation tools (create-react-app,django-admin startproject, etc.), expects to create a new, empty directory to place your project files into.When you use
./, you're telling it to create the project in the current directory. Since your current directory is not empty, it refuses to proceed to prevent accidentally deleting or overwriting your existing files.Here are the solutions:
Solution 1: Create a new directory for your project (Recommended)
This is the standard way to use such commands. You tell it to create a new folder, and it will put all the project files inside that folder.
# 1. Create a new directory for your LangGraph project mkdir my_new_langgraph_app # 2. Navigate into the new directory cd my_new_langgraph_app # 3. Now, run the 'langgraph new' command in this empty directory # Use '.' to signify the current (empty) directory langgraph new . --template new-langgraph-project-pythonOR (Even more common and direct):
You can specify the new directory name directly in the
langgraph newcommand, and it will create it for you:# From your current location, create a new directory named 'my_new_langgraph_app' # and put the project files inside it. langgraph new my_new_langgraph_app --template new-langgraph-project-python # Then, navigate into it to start working: cd my_new_langgraph_appSolution 2: Clear the current directory (Use with Extreme Caution!)
Only do this if you are absolutely sure you want to delete everything in your current directory. This is almost never the desired action.
# List files to make sure you want to delete them ls -la # Delete all files and directories in the current directory (DANGEROUS!) rm -rf * # Now, try the command again langgraph new . --template new-langgraph-project-pythonRecommendation: Go with Solution 1. It's the safer and intended way to initialize a new project.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.