Report this

What is the reason for this report?

Error when starting the React Tutorial App

Posted on August 19, 2025

I have followed the instruction for this tutorial on testing react with Playwright. Whenever I start the webapp, I get the following error:

ERROR in ./src/modules/WeatherInfoComponent.js 1:40-148

Module not found: Error: You attempted to import /Users/alexsombaty/Development/react-component-testing-demo/node_modules/react-refresh/runtime.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.

You can either move it inside src/, or add a symlink to it from project’s node_modules/.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

I think that this error usually happens when Create React App blocks imports outside of the src/ folder. react-refresh/runtime.js should already come from node_modules, so something may be misconfigured.

I would suggest making sure you didn’t accidentally import react-refresh directly in your code. It’s handled by the dev server automatically. And also try to delete node_modules and package-lock.json (or yarn.lock) and reinstall with npm install or yarn install.

This usually clears up with a clean reinstall. By the way, which tutorial exactly are you following?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.