• Home
  • Module not found you attempted to import which falls outside of the project src directory relative imports outside of src are not supported – React JS

Module not found you attempted to import which falls outside of the project src directory relative imports outside of src are not supported – React JS

This error occurs when you are trying to import a module that is not located in the src directory of your project. In order to fix this issue, you need to make sure that you are importing the module from the correct path.

If the module you are trying to import is located in the src directory, you can simply use a relative path to import it, like this:

import MyModule from './MyModule';

If the module is located in a subdirectory of src, you can use a path like this:

import MyModule from './subdirectory/MyModule';

If the module is located in a different directory outside of src, you will need to use an absolute path to import it. This is not recommended, as it can make your code harder to maintain and less portable.

If you are still having trouble, it’s possible that there is a problem with the module itself, or with the way it is being imported. In that case, you may want to try debugging the issue by adding some log statements or checking the module’s code to see if there are any issues there.