# NextJS 14.1 and Netlify NextJS Runtime v5 not Building Locally using Netlify Build command

**URL:** <https://answers.netlify.com/t/nextjs-14-1-and-netlify-nextjs-runtime-v5-not-building-locally-using-netlify-build-command/116280>\
**Category:** Support\
**Tags:** netlify-cli, building, netlify-newbie, nextjs\
**Created:** [April 11, 2024, 1:00am UTC](https://answers.netlify.com/t/nextjs-14-1-and-netlify-nextjs-runtime-v5-not-building-locally-using-netlify-build-command/116280 "2024-04-11T01:00:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Minesh](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@Minesh](https://answers.netlify.com/u/Minesh)\
**Post date:** [April 11, 2024, 1:00am UTC](https://answers.netlify.com/t/nextjs-14-1-and-netlify-nextjs-runtime-v5-not-building-locally-using-netlify-build-command/116280/1 "2024-04-11T01:00:23Z")

</div>

Hello I’m just reaching out for some support

I have a NextJS 14 solution on a monorepo, when trying to use the Netlify CLI to do a build I am getting the below error which I am struggling to debug. I have had to explicitly install the Netlify/plugin-nextjs as without this was always reverting to the v4 runtime. It is working fine when using the v4 Runtime. Can anyone point me in the right direction please

```auto
PS D:\DevrootArco\Arco\Commerce-Frontend> netlify build

We've detected multiple sites inside your repository
? Select the site you want to work with (Use arrow keys or type to search)
> frontend apps\frontend --filter frontend 
  @remkoj/optimizely-dxp-cli packages\remkoj\optimizely-dxp-cli --filter @remkoj/optimizely-dxp-cli 
  @remkoj/optimizely-dxp-nextjs packages\remkoj\optimizely-dxp-nextjs --filter @remkoj/optimizely-dxp-nextjs 
  @remkoj/optimizely-dxp-react packages\remkoj\optimizely-dxp-react --filter @remkoj/optimizely-dxp-react 
  @remkoj/optimizely-dxp-react-server packages\remkoj\optimizely-dxp-react-server --filter @remkoj/optimizely-dxp-react-
server 
  @remkoj/optimizely-graph-client packages\remkoj\optimizely-graph-client --filter @remkoj/optimizely-graph-client 
(Move up and down to reveal more choices)

? Select the site you want to work with frontend apps\frontend --filter frontend

Netlify Build
────────────────────────────────────────────────────────────────

❯ Version
  @netlify/build 29.36.1

❯ Flags
  dry: false
  offline: false
  packagePath: apps\frontend

❯ Current directory
  D:\DevrootArco\Arco\Commerce-Frontend

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

❯ Context
  production

❯ Using Next.js Runtime - v5.0.0

Cleaning up leftover files from previous builds
────────────────────────────────────────────────────────────────

(Pre cleanup completed in 3ms)

@netlify/plugin-nextjs (onPreBuild event)
────────────────────────────────────────────────────────────────

(@netlify/plugin-nextjs onPreBuild completed in 12ms)

Build command from Netlify app
────────────────────────────────────────────────────────────────

$ yarn run build
→ Generating configuration file for website with domain: commerce-frontend.netlify.app
→ Loaded website data, generating TypeScript code.
→ Writing code to: D:\DevrootArco\Arco\Commerce-Frontend\apps\frontend\src\site-config.ts
✔ Done
   ▲ Next.js 14.1.4
   - Environments: .env.local, .env
   - Experiments (use at your own risk):
     · instrumentationHook

   Creating an optimized production build ...
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
 ✓ Collecting page data
   Generating static pages (5/7) [==]
header-cta-store
 ✓ Generating static pages (7/7)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app) Size First Load JS
┌ ○ /_not-found 881 B 85.5 kB
├ ● /[lang]/[[...path]] 37.8 kB 132 kB
├ └ /en
├ λ /api/auth/[...nextauth] 0 B 0 B
├ λ /api/content/publish 0 B 0 B
├ λ /api/me/[[...path]] 0 B 0 B
├ λ /api/me/consent 0 B 0 B
├ ○ /manifest.webmanifest 0 B 0 B
├ ○ /robots.txt 0 B 0 B
└ ○ /sitemap.xml 0 B 0 B
+ First Load JS shared by all 84.6 kB
  ├ chunks/1dd3208c-e584ba0092b89950.js 53.4 kB
  ├ chunks/997-18b0fdbf65c5c120.js 29 kB
  └ other shared chunks (total) 2.2 kB

ƒ Middleware 60.6 kB

○ (Static) prerendered as static content
● (SSG) prerendered as static HTML (uses getStaticProps)
λ (Dynamic) server-rendered on demand using Node.js

→ Registering webhook target: https://commerce-frontend.netlify.app/api/content/publish?token=optly-PUBLISH_TOKEN

✔ Webhook already registered, no action needed

(build.command completed in 29.9s)

@netlify/plugin-nextjs (onBuild event)
────────────────────────────────────────────────────────────────

(@netlify/plugin-nextjs onBuild completed in 2.4s)

Functions bundling
────────────────────────────────────────────────────────────────

Packaging Functions from apps\frontend\.netlify\functions-internal directory:
 - ___netlify-server-handler\___ netlify-server-handler.mjs

(Functions bundling completed in 2.1s)

Edge Functions bundling
────────────────────────────────────────────────────────────────

Packaging Edge Functions from apps\frontend\.netlify\edge-functions directory:
 - ___netlify-edge-handler-src-middleware

(Edge Functions bundling completed in 3.9s)

@netlify/plugin-nextjs (onPostBuild event)
────────────────────────────────────────────────────────────────

@netlify/plugin-nextjs (onEnd event)
────────────────────────────────────────────────────────────────

(@netlify/plugin-nextjs onEnd completed in 11ms)

Save updated config
────────────────────────────────────────────────────────────────

(options.onEnd completed in 2ms)

Plugin "@netlify/plugin-nextjs" failed
────────────────────────────────────────────────────────────────

  Error message
  Error: Failed publishing static content

  Plugin details
  Package: @netlify/plugin-nextjs
  Version: 5.0.0
  Repository: git+https://github.com/netlify/next-runtime-minimal.git
  npm link: https://www.npmjs.com/package/@netlify/plugin-nextjs
  Report issues: https://github.com/netlify/next-runtime-minimal/issues

  Error location
  In "onPostBuild" event in "@netlify/plugin-nextjs" from Netlify app and package.json

  Resolved config
  build:
    command: yarn run build
    commandOrigin: ui
    publish: D:\DevrootArco\Arco\Commerce-Frontend\apps\frontend\.next
    publishOrigin: ui
  plugins:
    - inputs: {}
      origin: ui
      package: '@netlify/plugin-nextjs'
PS D:\DevrootArco\Arco\Commerce-Frontend> 

```

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [April 14, 2024, 11:18am UTC](https://answers.netlify.com/t/nextjs-14-1-and-netlify-nextjs-runtime-v5-not-building-locally-using-netlify-build-command/116280/2 "2024-04-14T11:18:36Z")

</div>

Does running a build on Netlify via git solve the issue?

---

<div class="post-metadata">

**Author:** ![Minesh](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@Minesh](https://answers.netlify.com/u/Minesh)\
**Post date:** [April 17, 2024, 4:26pm UTC](https://answers.netlify.com/t/nextjs-14-1-and-netlify-nextjs-runtime-v5-not-building-locally-using-netlify-build-command/116280/4 "2024-04-17T16:26:14Z")

</div>

Yes the Build via Git Works its just locally “netlify build” I get the error above

---

<div class="post-metadata">

**Author:** ![Minesh](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@Minesh](https://answers.netlify.com/u/Minesh)\
**Post date:** [April 17, 2024, 4:30pm UTC](https://answers.netlify.com/t/nextjs-14-1-and-netlify-nextjs-runtime-v5-not-building-locally-using-netlify-build-command/116280/5 "2024-04-17T16:30:23Z")

</div>

Updating to plugin v5.1.1 has ratified the issue.

---

<div class="post-metadata">

**Author:** ![SamO](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/samo/32/41847_2.png) [@SamO](https://answers.netlify.com/u/SamO)\
**Post date:** [April 17, 2024, 7:47pm UTC](https://answers.netlify.com/t/nextjs-14-1-and-netlify-nextjs-runtime-v5-not-building-locally-using-netlify-build-command/116280/6 "2024-04-17T19:47:57Z")

</div>

Hi, that’s good to hear. Thanks for coming back and sharing your solution with the community.
