skip to Main Content

I have done npm run build on my machine and it builds without a problem. But on vercel this is the error I am seeing. I have tried to go through my code but I can’t seem to find the problem.

I am using

next 14.0.4
[14:00:08.689] Cloning github.com/DanKamNdi/sheria-ai (Branch: launch, Commit: 5eb6be9)
[14:00:09.537] Cloning completed: 848.163ms
[14:00:16.357] Restored build cache
[14:00:16.440] Running "vercel build"
[14:00:16.921] Vercel CLI 33.2.0
[14:00:17.354] Installing dependencies...
[14:00:20.506] 
[14:00:20.507] added 13 packages in 3s
[14:00:20.507] 
[14:00:20.507] 41 packages are looking for funding
[14:00:20.508]   run `npm fund` for details
[14:00:20.523] Detected Next.js version: 14.0.4
[14:00:20.530] Detected `package-lock.json` generated by npm 7+
[14:00:20.531] Running "npm run build"
[14:00:21.646] 
[14:00:21.647] > [email protected] build
[14:00:21.647] > next build
[14:00:21.647] 
[14:00:22.307]    ▲ Next.js 14.0.4
[14:00:22.307] 
[14:00:22.308]    Creating an optimized production build ...
[14:00:32.610]  ✓ Compiled successfully
[14:00:32.611]    Linting and checking validity of types ...
[14:00:32.793]    Collecting page data ...
[14:00:35.092]    Generating static pages (0/11) ...
[14:00:35.304] 
   Generating static pages (2/11) 
[14:00:35.690] 
   Generating static pages (5/11) 
[14:00:35.717] 
[14:00:35.718]  ⚠ metadata.metadataBase is not set for resolving social open graph or twitter images, using "https://sheria-9up6k2n27-dankamndi.vercel.app". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase
[14:00:36.208] 
   Generating static pages (8/11) 
[14:00:36.392] 
 ✓ Generating static pages (11/11) 
[14:00:36.616]    Finalizing page optimization ...
[14:00:36.617]    Collecting build traces ...
[14:00:43.527] RangeError: Maximum call stack size exceeded
[14:00:43.528]     at parse (/vercel/path0/node_modules/next/dist/compiled/micromatch/index.js:15:6313)
[14:00:43.528]     at picomatch.makeRe (/vercel/path0/node_modules/next/dist/compiled/micromatch/index.js:15:21670)
[14:00:43.528]     at picomatch (/vercel/path0/node_modules/next/dist/compiled/micromatch/index.js:15:19637)
[14:00:43.528]     at /vercel/path0/node_modules/next/dist/compiled/micromatch/index.js:15:19294
[14:00:43.529]     at Array.map (<anonymous>)
[14:00:43.529]     at picomatch (/vercel/path0/node_modules/next/dist/compiled/micromatch/index.js:15:19286)
[14:00:43.529]     at micromatch.isMatch (/vercel/path0/node_modules/next/dist/compiled/micromatch/index.js:15:1090)
[14:00:43.529]     at /vercel/path0/node_modules/next/dist/build/collect-build-traces.js:245:48
[14:00:43.529]     at shouldIgnore (/vercel/path0/node_modules/next/dist/build/collect-build-traces.js:75:9)
[14:00:43.530]     at /vercel/path0/node_modules/next/dist/build/collect-build-traces.js:86:23
[14:00:43.581] Error: Command "npm run build" exited with 1
[14:00:43.799]```

2

Answers


  1. Chosen as BEST ANSWER

    The problem was a package called sharp The moment I removed it the project was able to build on Vercel.


  2. Add metadataBase URL

        import type { Metadata } from 'next'
         
        export const metadata: Metadata = {
          metadataBase: new URL('https://sheria-9up6k2n27-dankamndi.vercel.app')
          title: '...',
    
    }
    

    https://github.com/vercel/next.js/discussions/57251

    this discussion is exactly about the issue you are facing

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search