Error: Cannot find module ‘/home/runner/boilerplate-project-urlshortener/index.js’

I kept getting this error in the debugger when trying to complete the backend development certificate (first lesson in mongoDB subtopic).

I saw a similar forum post that said to open .replit file and then press run. I’ve done that but still the same error has shown. I followed a youtube video that did the same steps and nothing went wrong.

check if the name of the file that you have worked for the challenge is named index.js,if so go to package.json and ckeck if there is "main": "index.js", and it should be as that correctly written.
or you can use glitch instead of replit as you now running certificate projects locally is not allowed.

Importing Code from GitHub to Glitch

Yes! You can import your code from GitHub into your Glitch project! Here’s how…

Make sure you run enable-npm in the terminal.


Can I change the version of node.js my Glitch project uses?

You can do so by updating the engines field specified in the package.json project file.

as a final method you can use:-go to replit hompage/dashboard click myrepls and find the container with your project and delete it and start over your project.**but before doing that you should save all the project files that you have changed locally, and paste them on the new one.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.