Couldn't find opt/build/repo during deploy

Working on a new project and getting a mysterious build error. I’ve checked the build and support docs but couldn’t find this problem referenced. The forum had something but apparently not related.


  "name": "pgnfen3",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  "eslintConfig": {
    "extends": [
  "browserslist": {
    "production": [
      "not dead",
      "not op_mini all"
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"

Running netlify dev works okay. netlify build reports no errors:

netlify build

  Netlify Build                                                 

❯ Version
  @netlify/build 27.18.4

❯ Flags
  dry: false
  offline: false

❯ Current directory

❯ Config file
  No config file was defined: using default values.

❯ Context

  1. Build command from Netlify app                             

$ react-scripts build
Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  46.6 kB  build/static/js/main.f2d98ce5.js
  1.78 kB  build/static/js/787.ffec13a5.chunk.js
  541 B    build/static/css/main.073c9b0a.css

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  yarn global add serve
  serve -s build

Find out more about deployment here:

(build.command completed in 12.8s)

  2. Functions bundling                                         

No Functions were found in netlify/functions directory

(Functions bundling completed in 11ms)

  Netlify Build Complete                                        

(Netlify Build completed in 12.9s)

But the deploy fails with:

3:44:04 PM: $ yarn run build
3:44:04 PM: yarn run v1.22.19
3:44:04 PM: error Couldn't find a package.json file in "/opt/build/repo"

Note that the project is private but I have no problem making it public if you want to examine the full deployment log.

Hi @JeffML

Simply put, this means what it says, there is no package.json in the root of the repository.

Is the code at the root of the repository or in a sub directory? If the latter, you need to set the base directory accordingly.

If you have further issues, can you share the public repository link.

The error was due to a missing netlify.toml file. Not sure how it got lost.

Is that file not required? Shouldn’t the build step emit a warning at least?

No, a netlify.toml isn’t required. You can configure the build via the Netlify UI, or using file-based configuration (netlify.toml.)

As it is not required, no warning is given if it is missing.