Please advise error while deploying file /opt/build/repo/

I need advice to debug deployment of React site from Github to Netlify.
npm ERR! path /opt/build/repo/package.json

This is the repo.

without seeing the full build log, its a little hard to say exactly, but as the error message seems to be complaining about an absent package.json, and you have one in your repo, i might guess that you have a wrong path in your build settings. maybe you are telling us to look in the wrong place for that file?

1 Like

hi perry, I’ve edited base directory: / and publish directory: /public, wasted many hours changing both directories and receiving same error.

can you tell if it’s any syntax error or I need to set different path?

Hi, @inhyechoi. There is only one site for your account (for the email address used for this community site).

I checked that site and the most recent error is this:

10:30:15 AM: npm ERR! code ENOENT
10:30:15 AM: npm ERR! syscall open
10:30:15 AM: npm ERR! path /opt/build/repo/package.json
10:30:15 AM: npm ERR! errno -2
10:30:15 AM: npm ERR! enoent ENOENT: no such file or directory, open '/opt/build/repo/package.json'
10:30:15 AM: npm ERR! enoent This is related to npm not being able to find a file.
10:30:15 AM: npm ERR! enoent
10:30:15 AM: npm ERR! A complete log of this run can be found in:
10:30:15 AM: npm ERR!     /opt/buildhome/.npm/_logs/2020-08-09T17_30_15_419Z-debug.log

If I check the commit which triggered that build for that file (package.json) it doesn’t exist:

That is the commit and there is no package.json in the repo for that commit. This is the reason for the error.

If there are other questions, please let us know.

yeah-it’s fixed. thanks perry, I’ve changed setting a base directory to default and changing publish directory to build/ . I’ve changed the branch in the file (package.json) to the one that contains (package.json), it all makes sense now I think. thanks luke on checking error!

1 Like