Error: Cannot find module ‘/opt/render/project/src/app.js

Why is it showing this Error: Cannot find module ‘/opt/render/project/src/app.js’. ?
My package.json file is:
“name”: “portfoliopro”,
“version”: “1.0.0”,
“description”: “16.17.0”,
“main”: “index.js”,
“engines”: {
“node”: “16.17.0”,
“npm”: “8.15.0”
“scripts”: {
“test”: “echo "Error: no test specified" && exit 1”,
“server”: “nodemon server.js”,
“client”: “npm start --prefix client”,
“dev”: “concurrently "npm run server" "npm run client"”,
“heroku-postbuild”: “NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client”
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“concurrently”: “^6.5.1”,
“cors”: “^2.8.5”,
“dotenv”: “^10.0.0”,
“express”: “^4.17.1”,
“js-token”: “^1.0.0”,
“nodemailer”: “^6.6.3”,
“nodemon”: “^2.0.12”,
“react”: “^15.0.0 || ^16.0.0”,
“react-typical”: “^0.1.3”

I am using " npm install " as build command and " node app.js " as start command.

This is my github repo which i want to deploy:


It looks like you found the solution and your service has now deployed successfully, do you still require any help?

Jérémy, Render Support

1 Like

Hi, thank you for your reply! I have been able to deploy it but not successfully, the page cannot be found when deployed. I have changed a few things since my last post and now have a couple of backups for my repo as I have broken some of the original code.

As of now, this is the error I am getting this issue:

The page is completely blank

I am still unsure of the deploy and build setup as nothing is working for me. These are my options:

This is where my current repo lies for the project I want to deploy:

Would you mind having a look at my repo and seeing what I may have done wrong?


It doesn’t seem like you’ve set any root directory so when Render clones your repo it sees this file structure: There are no src/index.js here.

You may either want to set your root directory to “client/” or start your app with node “client/src/index.js”

Jérémy, Render Support

Thank you for your quick response and yes that does make a lot more sense now thanks to your recent reply.

I am starting my app with node “client/src/index.js” as you said and I feel like I am one step closing to being able to resolve the issues I am having.

[Option 1] After doing that, the error that is left after a redeployment is this:

[Option 2] I have also tried scouring the web, and another possible solution was to add "type": "module" to the package.json. Doing so gives me a new error:

Please let me know which option would be the best to proceed with and how I can fix either error. Thank you!

Well, it doesn’t look like you have any transpiler like Babel so ES6 syntax will not work. Also, you should probably use a Static Site [] for your frontend code and keep the Web Service for your backend.

If you have a single repo for both, make sure to simply set a proper “Root Directory”. More at

Jérémy, Render Support

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