opennextjs / opennextjs-netlify

Open Next.js adapter for Netlify
https://opennext.js.org/netlify
673 stars 86 forks source link

Deployment Issue on Netlify: Plugin Configuration Error NEXTJS 14.2.4 #2667

Open syeddilawar4444 opened 3 weeks ago

syeddilawar4444 commented 3 weeks ago

I am encountering difficulties while attempting to deploy my project on Netlify, which is functioning correctly with the yarn build command locally. Despite multiple attempts, the build process on Netlify consistently fails due to a plugin issue. I have already tried adjusting the version of the Netlify package plugin as a potential solution.

Additionally, I would like to clarify whether the configuration for deploying using Runtime v5 on Netlify (as outlined in the documentation here) is a requirement for my project. If it is not necessary, I am uncertain why I am facing deployment challenges.

I have attached a screenshot for further context regarding the issue.

Here is some info

NextJs version: 14.2.4 NodeJs: 18.20.3

Screenshot 2024-10-14 at 4 46 22 PM
serhalp commented 2 weeks ago

Hi @syeddilawar4444. Thanks for writing in.

We don't quite have enough information to effectively troubleshoot this as is. Could you please share your netlify.toml, package.json, and the command you are running that works correctly locally as well as the command you are running to deploy (or are you deploying automatically via git?)?

Also, to answer your question, yes the runtime is required, but it should be installed and used automatically without any configuration on your part.

Thanks!

syeddilawar4444 commented 2 weeks ago

Hi serhalp,

Thank you for your response!

To assist with troubleshooting, I’ve attached the following details as requested:

//netlify.toml
[[plugins]]
  package = "@netlify/plugin-nextjs"

[build.environment]
  NETLIFY_NEXT_PLUGIN_SKIP = "true"
  //package.json
  {
  "name": "next-js",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@hookform/resolvers": "^3.9.0",
    "@nextui-org/react": "^2.4.2",
    "@reduxjs/toolkit": "^2.2.6",
    "@types/rtl-detect": "^1.0.3",
    "axios": "^1.7.2",
    "country-state-city": "^3.2.1",
    "framer-motion": "^11.2.12",
    "google-libphonenumber": "^3.2.38",
    "intl-tel-input": "^24.5.0",
    "next": "14.2.4",
    "next-international": "^1.2.4",
    "next-themes": "^0.3.0",
    "react": "^18",
    "react-dom": "^18",
    "react-hook-form": "^7.52.2",
    "react-hot-toast": "^2.4.1",
    "react-international-phone": "^4.3.0",
    "react-redux": "^9.1.2",
    "rtl-detect": "^1.1.2",
    "swiper": "^11.1.4",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@iconify/react": "^5.0.1",
    "@netlify/plugin-nextjs": "^5.7.4",
    "@types/google-libphonenumber": "^7.4.30",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "14.2.4",
    "postcss": "^8",
    "prettier": "^3.3.3",
    "prettier-plugin-tailwindcss": "^0.6.6",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

The command I’m running locally that works: yarn build && yarn start The deployment process: I am using git. Regarding the runtime, I appreciate your confirmation that it should be automatically installed and used. If you notice anything off in the provided files or commands, please let me know!

Thanks again for your help!

Best regards, Syed Dilawar

serhalp commented 2 weeks ago

Thanks for sharing those details.

First, NETLIFY_NEXT_PLUGIN_SKIP is an env var that tells us to skip using our next runtime! You shouldn't set that. However, I don't think this is the cause of your issue (I believe it gets ignored if you also explicitly specify to use the @netlify/plugin-nextjs plugin in your netlify.toml). But let's start by removing that for good measure.

Can you try netlify build --offline locally instead of those yarn commands and share the full output? If you don't have the Netlify CLI, you'll need to run npm install -g netlify-cli@latest first.