Trouble Deploying Next JS site

I read the procedure for deploying Next JS apps to Netlify. However I ran into trouble.

  1. Problem installing the plugin.

  2. Netlify App
    Log Error:
    1:20:51 AM: Plugin “@netlify/plugin-nextjs” failed
    1:20:51 AM: ────────────────────────────────────────────────────────────────
    1:20:51 AM: ​
    1:20:51 AM: Error message
    1:20:51 AM: Error: Your publish directory is pointing to the base directory of your site. This is not supported for Next.js sites, and is probably a mistake.
    1:20:51 AM: In most cases it should be set to “.next”, unless you have chosen a custom “distDir” in your Next config, or the Next site is in a subdirectory.

hey there, did you see this note in the error message? can you share what your settings are currently?


Yes I saw the error. But when I add “.next” it fails as well. Latest build attempt shows whole new errors: Netlify App

@perry the build is treating all warnings as errors. I know how to solve it for a React build. Could you recommend some solution for Next JS build?

@perry @hillary

  1. I have tried adding CI = False in the environment var in build settings.
  2. I have tried both next build and CI= npm run build.
  3. I have also “disabling rules” as per this guide: Basic Features: ESLint | Next.js (nextjs.org)

My build keeps failing for ridiculous BS such as apostrophes. Please help.
Build log: Deploy details | lively-monstera-ba0c3a (netlify.com)

hi there, could you please share a screenshot of your build settings?




Apart from the one I sent previously, here are more. @perry

hi there, please try setting your build command to

CI= npm run build

with exactly that formatting, and see if that helps!

@perry I have tried with CI= npm run build several times. If you see the most recent build log, it still treats warnings as errors. That is not something that is getting solved by CI= npm run build.
I have not had this problem with React, but having it with Next.

@perry please check the result with CI= npm run build

Hey @zubin,

Did you try this:

Yes I did. It didn’t work.

There seems to be an additional link in your logs which points to:

try to add: ./next to publish directory field, not base

2 Likes

Thanks for sharing this, @uganoghli

I had the same problem and this fixed it for me as well. Thank you.