I am trying to deploy my Node.js project on Render, but the deployment fails during the npm install step. The logs show the following error:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/render/project/src/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/opt/render/project/src/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
During the deployment process on Render, it successfully clones the repository and checks out the correct commit. It also identifies and uses Node version 20.12.2 and Bun version 1.1.0 as specified. However, when it tries to run npm install, it fails because it cannot find the package.json file in the expected directory (/opt/render/project/src/package.json).
# What I Tried:
Verified that the package.json file is present in the root directory of my repository.
Ensured that the repository is cloned correctly and the specified commit contains the package.json file.
Double-checked the build and start commands specified in the Render service settings.
What I Expected:
The npm install command should locate the package.json file in the root directory of my project and install the necessary dependencies without any errors.
Mohan Duhan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.