Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Can't resolve '../error-config'

In the student form project (React-16) 'Catching Errors with Errors Boundaries' I am getting this error

Failed to compile
./src/components/ErrorBoundary.js
Module not found: Can't resolve '../error-config' in '/Users/nicorithner/coding_practice/frontend_practice/React_Stuff/react-16/student-form/src/components'
This error occurred during the build time and cannot be dismissed.

I did a global search and error-config is not in my project. How do I add it?

Thank you

2 Answers

Torben Korb
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Torben Korb
Front End Web Development Techdegree Graduate 91,433 Points

Hi Nico, can you post the link to the academy? Or I guess it's secured content only available to students.

Try to remove all references, even the commented ones, to error-config and sendError method. Those are not available at the time. Also try to restart your dev server if you still run into this error. Usually it has nothing to do with the error because it's only application code and not server code but to sort out everything a restart could help.

Also in general it would be good to include a .gitignore file to prevent the node_modules folder to be included in your repository. The folder can be rebuild easily with the command npm install when installing in a different environment.

See this link for adding gitignore and removing node_modules folder from the repo: https://sebhastian.com/git-ignore-node_modules/

Happy coding!

Thank you Torben!

Torben Korb
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Torben Korb
Front End Web Development Techdegree Graduate 91,433 Points

Hi Nico,

seems like in your Error-Boundary.js component is an import or require statement (probably at the top of the file) which tries to resolve a missing file "../error-config". Check if there is a file and probably this is just a typo in the path or file name.

Maybe it should be "./error-config" (only one dot before the slash) or "../error-config.js" (file extension added). This first would be the case if the error-config file is in the components folder (same folder as the file that calls this import).

Hope this helps to find the cause of the error. Happy coding!

Thank you Torben, I did try that. I tried multiple combinations of that. Here is the link to my repo: https://github.com/Coding-Gymnasium/react-16/blob/main/src/components/ErrorBoundary.js

I did a global search and didn't find the file. I wonder whether I missed a step. thank you for your help!