So i'm deploy my Next.js project (Frontend) on to Vercel. My previous ones were smooth, but not this time when it keep npm install
after build successfully.
Here is the full log:
[12:03:19.845] Running build in Washington, D.C., USA (East) – iad1
[12:03:19.955] Cloning github/tomdapchai/shop-co3049-fe (Branch: main, Commit: 1c629c5)
[12:03:20.529] Previous build cache not available
[12:03:22.433] Cloning completed: 2.477s
[12:03:22.928] Running "vercel build"
[12:03:23.275] Vercel CLI 41.1.3
[12:03:23.940] Running "install" command: `npm install --legacy-peer-deps`...
[12:03:38.492]
[12:03:38.493] added 527 packages, and audited 528 packages in 14s
[12:03:38.494]
[12:03:38.494] 161 packages are looking for funding
[12:03:38.494] run `npm fund` for details
[12:03:38.496]
[12:03:38.496] found 0 vulnerabilities
[12:03:38.497] npm notice
[12:03:38.497] npm notice New major version of npm available! 10.8.2 -> 11.1.0
[12:03:38.497] npm notice Changelog: .1.0
[12:03:38.497] npm notice To update run: npm install -g [email protected]
[12:03:38.498] npm notice
[12:03:38.516] Detected Next.js version: 15.1.7
[12:03:38.517] Running "next build"
[12:03:39.078] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[12:03:39.078] This information is used to shape Next.js' roadmap and prioritize features.
[12:03:39.079] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[12:03:39.079]
[12:03:39.079]
[12:03:39.186] ▲ Next.js 15.1.7
[12:03:39.187]
[12:03:39.216] Creating an optimized production build ...
[12:04:09.658] ✓ Compiled successfully
[12:04:09.664] Linting and checking validity of types ...
[12:04:12.578] ⨯ ESLint: Failed to load config "standard" to extend from. Referenced from:
[12:04:21.031] Collecting page data ...
[12:04:25.193] Generating static pages (0/26) ...
[12:04:26.563] Generating static pages (6/26)
[12:04:26.563] Generating static pages (12/26)
[12:04:26.632] Generating static pages (19/26)
[12:04:26.672] ✓ Generating static pages (26/26)
[12:04:27.309] Finalizing page optimization ...
[12:04:27.320] Collecting build traces ...
[12:04:33.660]
[12:04:33.678] Route (app) Size First Load JS
[12:04:33.679] ┌ ○ / 12.1 kB 162 kB
[12:04:33.679] ├ ○ /_not-found 989 B 107 kB
[12:04:33.679] ├ ƒ /[...not-found] 484 B 110 kB
[12:04:33.679] ├ ○ /about 1.92 kB 138 kB
[12:04:33.679] ├ ○ /admin/blogs 5.44 kB 182 kB
[12:04:33.679] ├ ƒ /admin/blogs/[blogId] 6.52 kB 203 kB
[12:04:33.679] ├ ○ /admin/blogs/create 6.09 kB 203 kB
[12:04:33.679] ├ ○ /admin/contacts 8.13 kB 151 kB
[12:04:33.680] ├ ○ /admin/dashboard 113 kB 274 kB
[12:04:33.680] ├ ○ /admin/images 3.68 kB 143 kB
[12:04:33.680] ├ ○ /admin/orders 4.56 kB 178 kB
[12:04:33.680] ├ ○ /admin/products 4.97 kB 148 kB
[12:04:33.680] ├ ƒ /admin/products/[slug] 7.29 kB 207 kB
[12:04:33.680] ├ ○ /admin/products/create 4.85 kB 201 kB
[12:04:33.680] ├ ○ /admin/reviews 3.03 kB 172 kB
[12:04:33.680] ├ ○ /admin/sign-in 155 B 168 kB
[12:04:33.680] ├ ○ /admin/siteInfo 5.59 kB 197 kB
[12:04:33.680] ├ ○ /admin/tags 7.73 kB 151 kB
[12:04:33.680] ├ ○ /admin/users 6.61 kB 167 kB
[12:04:33.680] ├ ƒ /admin/users/[userId] 5.83 kB 252 kB
[12:04:33.681] ├ ○ /blog 5.37 kB 145 kB
[12:04:33.681] ├ ƒ /blog/[blogId] 1.12 kB 137 kB
[12:04:33.681] ├ ○ /cart 2.68 kB 148 kB
[12:04:33.681] ├ ○ /checkout 3.54 kB 215 kB
[12:04:33.681] ├ ○ /contact 7.75 kB 164 kB
[12:04:33.681] ├ ƒ /product/[slug] 9.25 kB 196 kB
[12:04:33.681] ├ ƒ /profile/[userId]/detail 1.03 kB 203 kB
[12:04:33.681] ├ ƒ /profile/[userId]/orders-history 3.7 kB 180 kB
[12:04:33.681] ├ ƒ /profile/[userId]/security 3.95 kB 163 kB
[12:04:33.681] ├ ○ /shop 4.08 kB 181 kB
[12:04:33.681] ├ ○ /sign-in 154 B 168 kB
[12:04:33.681] ├ ○ /sign-up 5.22 kB 168 kB
[12:04:33.681] └ ƒ /success/[orderId] 2.96 kB 150 kB
[12:04:33.682] + First Load JS shared by all 106 kB
[12:04:33.682] ├ chunks/1517-0988262d3b99e048.js 50.7 kB
[12:04:33.682] ├ chunks/4bd1b696-aa4647faecd39f0a.js 53 kB
[12:04:33.682] └ other shared chunks (total) 1.97 kB
[12:04:33.682]
[12:04:33.682]
[12:04:33.682] ƒ Middleware 32.1 kB
[12:04:33.682]
[12:04:33.683] ○ (Static) prerendered as static content
[12:04:33.683] ƒ (Dynamic) server-rendered on demand
[12:04:33.683]
[12:04:33.910] Traced Next.js server files in: 119.365ms
[12:04:34.226] Created all serverless functions in: 316.471ms
[12:04:34.278] Collected static files (public/, static/, .next/static): 15.939ms
[12:04:34.304] Installing dependencies...
[12:04:35.521] npm error code ERESOLVE
[12:04:35.521] npm error ERESOLVE could not resolve
[12:04:35.521] npm error
[12:04:35.521] npm error While resolving: [email protected]
[12:04:35.521] npm error Found: [email protected]
[12:04:35.521] npm error node_modules/react
[12:04:35.521] npm error react@"^19.0.0" from the root project
[12:04:35.521] npm error peer react@">=16.8.0" from @floating-ui/[email protected]
[12:04:35.522] npm error node_modules/@floating-ui/react-dom
[12:04:35.522] npm error @floating-ui/react-dom@"^2.0.0" from @radix-ui/[email protected]
[12:04:35.522] npm error node_modules/@radix-ui/react-popper
[12:04:35.522] npm error @radix-ui/react-popper@"1.2.2" from @radix-ui/[email protected]
[12:04:35.522] npm error node_modules/@radix-ui/react-menu
[12:04:35.522] npm error @radix-ui/react-menu@"2.1.6" from @radix-ui/[email protected]
[12:04:35.522] npm error node_modules/@radix-ui/react-dropdown-menu
[12:04:35.522] npm error 3 more (@radix-ui/react-popover, @radix-ui/react-select, @radix-ui/react-tooltip)
[12:04:35.522] npm error 54 more (@radix-ui/react-accordion, @radix-ui/react-arrow, ...)
[12:04:35.522] npm error
[12:04:35.522] npm error Could not resolve dependency:
[12:04:35.522] npm error peer react@"^18.0.0" from [email protected]
[12:04:35.522] npm error node_modules/cmdk
[12:04:35.522] npm error cmdk@"^1.0.0" from the root project
[12:04:35.522] npm error
[12:04:35.522] npm error Conflicting peer dependency: [email protected]
[12:04:35.522] npm error node_modules/react
[12:04:35.522] npm error peer react@"^18.0.0" from [email protected]
[12:04:35.522] npm error node_modules/cmdk
[12:04:35.522] npm error cmdk@"^1.0.0" from the root project
[12:04:35.522] npm error
[12:04:35.522] npm error Fix the upstream dependency conflict, or retry
[12:04:35.522] npm error this command with --force or --legacy-peer-deps
[12:04:35.522] npm error to accept an incorrect (and potentially broken) dependency resolution.
[12:04:35.522] npm error
[12:04:35.522] npm error
[12:04:35.522] npm error For a full report see:
[12:04:35.522] npm error /vercel/.npm/_logs/2025-02-16T05_04_34_391Z-eresolve-report.txt
[12:04:35.526] npm error A complete log of this run can be found in: /vercel/.npm/_logs/2025-02-16T05_04_34_391Z-debug-0.log
[12:04:35.542] Error: Command "npm install" exited with 1
[12:04:35.849]
You can see that I tried using npm install --legacy-peer-deps
override the default on in Build & Development Settings and it works with first install, then build successfully. But right after that it starts npm install
again and this causes error, which should has been avoided by using npm install --legacy-peer-deps
above. I have no idea why it run npm install
again after successfully build.
Here are my configs file:
eslint.config.mjs:
import { dirname } from "path"; import { fileURLToPath } from "url"; import { FlatCompat } from "@eslint/eslintrc"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const compat = new FlatCompat({ baseDirectory: __dirname, }); const eslintConfig = [ ..pat.extends("next/core-web-vitals", "next/typescript", "standard"), ]; export default eslintConfig;
next.config.ts:
import type { NextConfig } from "next"; const nextConfig: NextConfig = { /* config options here */ images: { remotePatterns: [ { protocol: "https", hostname: "**", }, ], domains: ["res.cloudinary"], }, }; export default nextConfig;
vercel.json:
{ "buildCommand": "next build", "devCommand": "npm run dev", "installCommand": "npm install --legacy-peer-deps" }
package.json:
{ "name": "shop-co3049-fe", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@hookform/resolvers": "^4.1.0", "@radix-ui/react-accordion": "^1.2.3", "@radix-ui/react-avatar": "^1.1.3", "@radix-ui/react-checkbox": "^1.1.4", "@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-dropdown-menu": "^2.1.6", "@radix-ui/react-label": "^2.1.2", "@radix-ui/react-popover": "^1.1.6", "@radix-ui/react-scroll-area": "^1.2.3", "@radix-ui/react-select": "^2.1.6", "@radix-ui/react-separator": "^1.1.2", "@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-tabs": "^1.1.3", "@radix-ui/react-toast": "^1.2.6", "@radix-ui/react-tooltip": "^1.1.8", "axios": "^1.7.9", "bcryptjs": "^3.0.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.0.0", "date-fns": "^4.1.0", "embla-carousel-autoplay": "^8.5.2", "embla-carousel-react": "^8.5.2", "html-react-parser": "^5.2.2", "js-cookie": "^3.0.5", "lucide-react": "^0.475.0", "next": "15.1.7", "react": "^19.0.0", "react-country-region-selector": "^4.0.2", "react-day-picker": "^8.10.1", "react-dom": "^19.0.0", "react-hook-form": "^7.54.2", "recharts": "^2.15.1", "tailwind-merge": "^3.0.1", "tailwindcss-animate": "^1.0.7", "uuid": "^11.0.5", "zod": "^3.24.2" }, "devDependencies": { "@eslint/eslintrc": "^3", "@types/js-cookie": "^3.0.6", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", "eslint": "^9", "eslint-config-next": "15.1.7", "postcss": "^8", "tailwindcss": "^3.4.1", "typescript": "^5" } }
Thanks for any help!