Netlify Build Issue for Nextjs 14

Hi all I’ve been having issues creating and deploying a new build. I’ve tried changing and updating my Netlify TOML file and build commands. GitHub - mahj79/jmaho_blog is the repo I’m pulling from and the error logs I get are:

3:17:03 PM: $ npm run build
3:17:03 PM: npm error code ENOENT
3:17:03 PM: npm error syscall open
3:17:03 PM: npm error path /opt/build/repo/package.json
3:17:03 PM: npm error errno -2
3:17:03 PM: npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
3:17:03 PM: npm error enoent This is related to npm not being able to find a file.
3:17:03 PM: npm error enoent
3:17:03 PM: npm error A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2024-06-26T20_17_03_792Z-debug-0.log
3:17:03 PM: ​
3:17:03 PM: “build.command” failed
3:17:03 PM: ────────────────────────────────────────────────────────────────
3:17:03 PM: ​
3:17:03 PM: Error message
3:17:03 PM: Command failed with exit code 254: npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
3:17:03 PM: ​
3:17:03 PM: Error location
3:17:03 PM: In Build command from Netlify app:
3:17:03 PM: npm run build
3:17:03 PM: ​
3:17:03 PM: Resolved config
3:17:03 PM: build:
3:17:03 PM: command: npm run build
3:17:03 PM: commandOrigin: ui
3:17:03 PM: environment:
3:17:03 PM: - NETLIFY_NEXT_PLUGIN_SKIP
3:17:03 PM: publish: /opt/build/repo/out
3:17:03 PM: publishOrigin: ui
3:17:03 PM: plugins:
3:17:03 PM: - inputs: {}
3:17:03 PM: origin: ui
3:17:03 PM: package: ‘@netlify/plugin-nextjs’
3:17:04 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
3:17:04 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:17:04 PM: Failing build: Failed to build site
3:17:04 PM: Finished processing build request in 26.256s

Any help is much appreciated!

Hi, @mahj79. In the site’s “Build & deploy” settings change the “Base directory” setting to jacks_blog.

This is required because your package.json file is in that subdirectory in the repo at GitHub. If that doesn’t fix it, please let us know.

Just tried and it works! Thank you so much! Very silly mistake on my end that wasted a lot of time…