vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.84k stars 26.96k forks source link

Unable to build nextjs 14 app router on linux server machine but able to build on my local machine #64588

Closed vfxproForex closed 6 months ago

vfxproForex commented 6 months ago

Link to the code that reproduces this issue

https://github.com/vfxproForex/lafinaleftx

To Reproduce

On server machine:

  1. When i run npm run build this is what the expected output to be:

    
    > next build
    
    ▲ Next.js 14.2.1
    
    Creating an optimized production build ...
    ✓ Compiled successfully
    Linting and checking validity of types  ... ⨯ ESLint: Failed to load config "next/core-web-vitals" to extend from. Referenced from: /Users/tony/workspace/freelance/kurisani/pinnaclefx/.eslintrc.json
    ✓ Linting and checking validity of types
    ✓ Collecting page data
    ✓ Generating static pages (18/18)
    ✓ Collecting build traces
    ✓ Finalizing page optimization

Route (app) Size First Load JS ┌ ○ / 2.16 kB 101 kB ├ ○ /_not-found 871 B 87.8 kB ├ ○ /account 1.88 kB 106 kB ├ ○ /account/accountDetails 2.07 kB 106 kB ├ ○ /account/accountDetails/userDetails 2.38 kB 104 kB ├ ○ /account/deposits 8.93 kB 106 kB ├ ○ /account/deposits/mastercard 3.02 kB 93.2 kB ├ ○ /account/deposits/successful 157 B 87.1 kB ├ ○ /account/deposits/test 599 B 87.6 kB ├ ○ /account/deposits/visa 2.24 kB 92.4 kB ├ ○ /account/withdraw 2.53 kB 108 kB ├ ○ /checkEmail 397 B 87.4 kB ├ ○ /passwordReset 156 B 87.1 kB ├ ƒ /passwordReset/newpassword/[slug] 157 B 87.1 kB ├ ○ /register 2.02 kB 98.8 kB ├ ƒ /register/confirmAccount/[slug] 890 B 92.6 kB └ ○ /signin 1.1 kB 99.6 kB

Current vs. Expected behavior

However I get the following instead:

> lafinaleftx@0.1.0 build
> next build

  ▲ Next.js 14.2.1
  - Environments: .env

   Creating an optimized production build ...
 ⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
root@server:~/workspace/pinnacleftx/frontend# lsb_release -a
No LSB modules are available.

I've also tried npm run build --verbose but not getting any useful information:

> lafinaleftx@0.1.0 build
> next build

  ▲ Next.js 14.2.1
  - Environments: .env

   Creating an optimized production build ...
 ⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
root@server:~/workspace/pinnacleftx/frontend# rm -rf .next/
root@server:~/workspace/pinnacleftx/frontend# npm run build --verbose
npm verb cli /root/.nvm/versions/node/v20.12.2/bin/node /root/.nvm/versions/node/v20.12.2/bin/npm
npm info using npm@10.5.0
npm info using node@v20.12.2
npm verb title npm run build
npm verb argv "run" "build" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/root/.npm/_logs/2024-04-16T22_19_47_733Z-
npm verb logfile /root/.npm/_logs/2024-04-16T22_19_47_733Z-debug-0.log

> lafinaleftx@0.1.0 build
> next build

  ▲ Next.js 14.2.1
  - Environments: .env

   Creating an optimized production build ...
 ⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
npm verb exit 0
npm info ok

My package.json is as follows:

{
  "name": "lafinaleftx",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@react-icons/all-files": "^4.1.0",
    "@reduxjs/toolkit": "^2.2.3",
    "js-cookie": "^3.0.5",
    "next": "14.2.1",
    "react": "^18",
    "react-dom": "^18",
    "react-hot-toast": "^2.4.1",
    "react-icons": "^5.1.0",
    "react-redux": "^9.1.1",
    "react-toastify": "^10.0.5",
    "redux": "^5.0.1",
    "redux-thunk": "^3.1.0",
    "sharp": "^0.33.3",
    "uuid": "^9.0.1"
  },
  "devDependencies": {
    "@types/js-cookie": "^3.0.6",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "@types/uuid": "^9.0.8",
    "eslint": "^8",
    "eslint-config-next": "14.2.1",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

And I've also tried to delete node_module, .next & package-lock.json files.

I've also tried to increase my ram size from 1gig to 2gig and still getting the same results on my server machine. I'm using digital ocean by the way.

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64
  Available memory (MB): 4096
  Available CPU cores: 4
Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.4
Relevant Packages:
  next: 14.2.1 // Latest available version is detected (14.2.1).
  eslint-config-next: 14.2.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure, Image optimization (next/image, next/legacy/image), Package manager (npm, pnpm, Yarn)

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Other (Deployed)

Additional context

![Uploading Screenshot 2024-04-17 at 00.10.47.png…]()

github-actions[bot] commented 6 months ago

We could not detect a valid reproduction link. Make sure to follow the bug report template carefully.

Why was this issue closed?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We need a link to a public GitHub repository (template for App Router, template for Pages Router), but you can also use these templates: CodeSandbox: App Router or CodeSandbox: Pages Router.

The bug template that you filled out has a section called "Link to the code that reproduces this issue", which is where you should provide the link to the reproduction.

What should I do?

Depending on the reason the issue was closed, you can do the following:

In general, assume that we should not go through a lengthy onboarding process at your company code only to be able to verify an issue.

My repository is private and cannot make it public

In most cases, a private repo will not be a sufficient minimal reproduction, as this codebase might contain a lot of unrelated parts that would make our investigation take longer. Please do not make it public. Instead, create a new repository using the templates above, adding the relevant code to reproduce the issue. Common things to look out for:

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps by opening a new issue.

I think my reproduction is good enough, why aren't you looking into it quickly?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources