I have some files in my root but render keeps on searching that file in a specific folder

Error:
npm error code ENOENT

Nov 3 04:12:07 PMnpm error syscall open

Nov 3 04:12:07 PMnpm error path /opt/render/project/src/frontend/package.json

Nov 3 04:12:07 PMnpm error errno -2

Nov 3 04:12:07 PMnpm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open ‘/opt/render/project/src/frontend/package.json’

Nov 3 04:12:07 PMnpm error enoent This is related to npm not being able to find a file.

Nov 3 04:12:07 PMnpm error enoent

Nov 3 04:12:07 PMnpm error A complete log of this run can be found in: /opt/render/.cache/_logs/2024-11-03T10_42_06_933Z-debug-0.log

I have two package.json one in my root for backend and other in frontend and it keeps searching in the frontend folder which leads to failed deployment.

Your service’s Settings on the Render Dashboard likely has “Root Directory” set to frontend.

When deploying my web service i keep the root directory blank but render keeps searching the package.json file in frontend instead of the root directory

github repo

  1. There are no relevant files in the root directory of that repo.
  2. Your directory has a capital F in Frontend, and will not find a directory named frontend, because Linux is case sensitive. (Also, capital B in Backend.)
  3. There is no package.json in the root directory, you must specify a Root Directory setting in Render to either Backend or Frontend, to find the package.json file in one or the other’s directory.

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