Noob question.
When I run Claude within the Replit shell, Claude keeps asking to run the dev server itself. Are there any recommendations so I can ask Claude to use Replit’s command to compile and run the server?
Are you sure it’s not just running the dev server in Replit? I do this to and that’s what happens
At the end of any code change in the shell running claude code, it asks me if it can run the dev server. when i say yes, it errors out because of port conflict, and then kills the replit server and starts its own. So, at this time, when you go to the “preview” tab, its an error. and the only think i can do is either
- kill off the replit window and when it restarts, it will auto-compile and the preview works fine.
- kill off claude in the shell, and press play against the project in replit main window.
I haven’t tried this within replit, It’s a bit dangerous as it can mess up your .replit package.json or other key files. I highly recommend running projects locally but if you must:
- Git version your repl (backup) start new branch for claude-dev-env-setup
- Ask claude to create a dev.sh file and make it run with fallback ports. Instruct it to display the port number that was successfully used to start the server
- Test it your self by, make sure server isn’t running
- Then go to the shell and type ./dev.sh
– As the server starts it will show you the port number used - Load the app in your browser using the replit.dev url then use the port number
if all works then update your
-
claude.md file tell it to start the server, use ./dev.sh
-
Save and commit your branch, then switch to main and test again. This allows you to always go back to previous working state.
if it fails in the early steps its most likely do to .replit and other critical files are locked. You can ask claude to tell you what modifications are needed on those files so you can manually apply them. Iterate until you get ./dev.sh working for you.
You won’t be able to use the preview you’ll just have to open the browser to the port the script decided to use.
Proceed with caution and good luck.