Next.js Discord

Discord Forum

Error: Command "npm run build" exited with 1

Unanswered
Bluetick Coonhound posted this in #help-forum
Open in Discord
Bluetick CoonhoundOP
[12:06:17.186] Running build in Washington, D.C., USA (East) – iad1
[12:06:17.296] Cloning github.com/Cyroen/manipesto-util (Branch: main, Commit: 9d384d2)
[12:06:17.319] Skipping build cache, deployment was triggered without cache.
[12:06:17.781] Cloning completed: 484.253ms
[12:06:18.119] Running "vercel build"
[12:06:18.571] Vercel CLI 39.3.0
[12:06:18.904] Installing dependencies...
[12:06:34.530] 
[12:06:34.531] added 187 packages in 15s
[12:06:34.532] 
[12:06:34.532] 37 packages are looking for funding
[12:06:34.532]   run `npm fund` for details
[12:06:34.532] npm notice
[12:06:34.533] npm notice New major version of npm available! 10.9.2 -> 11.0.0
[12:06:34.533] npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
[12:06:34.533] npm notice To update run: npm install -g npm@11.0.0
[12:06:34.534] npm notice
[12:06:34.671] Detected Next.js version: 15.1.4
[12:06:34.674] Running "npm run build"
[12:06:34.906] 
[12:06:34.908] > manipesto-util@0.1.0 build
[12:06:34.909] > next build
[12:06:34.909] 
[12:06:36.137] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[12:06:36.138] This information is used to shape Next.js' roadmap and prioritize features.
[12:06:36.138] 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:06:36.138] https://nextjs.org/telemetry
[12:06:36.138] 
[12:06:36.337]    ▲ Next.js 15.1.4
[12:06:36.337] 
[12:06:36.433]    Creating an optimized production build ...
[12:07:00.142]  ✓ Compiled successfully
[12:07:00.147]    Linting and checking validity of types ...
[12:07:00.279] Error: Command "npm run build" exited with 1
[12:07:00.724] 

201 Replies

Bluetick CoonhoundOP
Yeah no, I don't really know what's happening here
Building it locally seems to work fine but deploying it is another problem
Northeast Congo Lion
me to
freak outta herte
just quit
i did
you should too
wait no jk lmao
dont
keep trying
but goodluck
Bluetick CoonhoundOP
Yeah, found a reddit thread about it but no luck there either
Bluetick CoonhoundOP
checked npm run lint and everything seems to be okay too
No error or warnings
added eslint: { ignoreDuringBuilds: true } to config file and still nothing
Northeast Congo Lion
ye was happening to me
lmao
i feel u
Bluetick CoonhoundOP
checking my old deploys in my other project rn
Changing node version don't work either
Bluetick CoonhoundOP
skipped linting and validation of types and still not luck
Dwarf Hotot
Again run the build in local
Share the output
Bluetick CoonhoundOP
Alright
@Dwarf Hotot Share the output
Bluetick CoonhoundOP
here's the package.json if that's needed
Dwarf Hotot
At last what is coming termination are you terminating it
Bluetick CoonhoundOP
not really terminating it
I also checked the Node versions, React, Next and Typescript versions
Dwarf Hotot
Is it coming automatically
Bluetick CoonhoundOP
The error?
In Vercel only
It builds fine in Local
Dwarf Hotot
Is this your first build
Bluetick CoonhoundOP
Vercel first build, yeah
Dwarf Hotot
Ok so you have push the code to deploy for first time and build fails in first attempt
On vercel
Bluetick CoonhoundOP
That's how it was, yeah
Dwarf Hotot
Share the whole package json file
Bluetick CoonhoundOP
{
  "name": "project-01",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@emotion/react": "^11.14.0",
    "@emotion/styled": "^11.14.0",
    "@mui/icons-material": "^6.4.0",
    "@mui/material": "^6.4.0",
    "axios": "^1.7.9",
    "cookies-next": "^5.1.0",
    "html2canvas": "^1.4.1",
    "next": "15.1.4",
    "next-auth": "^5.0.0-beta.25",
    "qrcode": "^1.5.4",
    "react": "^19.0.0",
    "react-dom": "^19.0.0"
  },
  "devDependencies": {
    "eslint": "^9.18.0",
    "eslint-config-next": "15.1.5",
    "sass": "^1.83.4",
    "typescript": "^5.7.3"
  },
  "engines": {
    "node": "22.x"
  }
}
Dwarf Hotot
Share the latest vercel fail build whole
Bluetick CoonhoundOP
[12:58:37.570] Running build in Washington, D.C., USA (East) – iad1
[12:58:37.671] Cloning github.com/Cyroen/manipesto-util (Branch: main, Commit: 8ca1e9d)
[12:58:37.778] VERCEL_FORCE_NO_BUILD_CACHE is set so skipping build cache step
[12:58:38.225] Cloning completed: 552.522ms
[12:58:38.545] Running "vercel build"
[12:58:39.001] Vercel CLI 39.3.0
[12:58:39.337] Installing dependencies...
[12:58:57.716] 
[12:58:57.717] added 422 packages in 18s
[12:58:57.718] 
[12:58:57.718] 145 packages are looking for funding
[12:58:57.718]   run `npm fund` for details
[12:58:57.719] npm notice
[12:58:57.719] npm notice New major version of npm available! 10.9.2 -> 11.0.0
[12:58:57.719] npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
[12:58:57.719] npm notice To update run: npm install -g npm@11.0.0
[12:58:57.720] npm notice
[12:58:57.905] Detected Next.js version: 15.1.4
[12:58:57.906] Running "npm run build"
[12:58:58.062] 
[12:58:58.063] > manipesto-util@0.1.0 build
[12:58:58.063] > next build
[12:58:58.063] 
[12:58:58.806] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[12:58:58.807] This information is used to shape Next.js' roadmap and prioritize features.
[12:58:58.807] 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:58:58.808] https://nextjs.org/telemetry
[12:58:58.808] 
[12:58:58.875]    ▲ Next.js 15.1.4
[12:58:58.875] 
[12:58:58.947]    Creating an optimized production build ...
[12:59:21.874]  ✓ Compiled successfully
[12:59:21.880]    Skipping validation of types
[12:59:21.880]    Skipping linting
[12:59:21.983] Error: Command "npm run build" exited with 1
[12:59:22.440] 
Dwarf Hotot
And also share the starting first build you have made
Bluetick CoonhoundOP
[11:52:26.390] Running build in Washington, D.C., USA (East) – iad1
[11:52:26.494] Cloning github.com/Cyroen/manipesto-util (Branch: main, Commit: 9d384d2)
[11:52:26.894] Previous build cache not available
[11:52:27.497] Cloning completed: 1.005s
[11:52:28.398] Running "vercel build"
[11:52:29.275] Vercel CLI 39.3.0
[11:52:29.617] Installing dependencies...
[11:52:46.661] 
[11:52:46.661] added 187 packages in 17s
[11:52:46.662] 
[11:52:46.662] 37 packages are looking for funding
[11:52:46.662]   run `npm fund` for details
[11:52:46.667] npm notice
[11:52:46.667] npm notice New major version of npm available! 10.9.2 -> 11.0.0
[11:52:46.667] npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
[11:52:46.667] npm notice To update run: npm install -g npm@11.0.0
[11:52:46.667] npm notice
[11:52:46.764] Detected Next.js version: 15.1.4
[11:52:46.766] Running "npm run build"
[11:52:47.153] 
[11:52:47.154] > manipesto-util@0.1.0 build
[11:52:47.154] > next build
[11:52:47.154] 
[11:52:48.471] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[11:52:48.471] This information is used to shape Next.js' roadmap and prioritize features.
[11:52:48.471] 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:
[11:52:48.471] https://nextjs.org/telemetry
[11:52:48.472] 
[11:52:48.533]    ▲ Next.js 15.1.4
[11:52:48.533] 
[11:52:48.600]    Creating an optimized production build ...
[11:53:12.028]  ✓ Compiled successfully
[11:53:12.033]    Linting and checking validity of types ...
[11:53:12.157] Error: Command "npm run build" exited with 1
[11:53:13.716] 
That's the first one
@Bluetick Coonhound [12:58:37.570] Running build in Washington, D.C., USA (East) – iad1 [12:58:37.671] Cloning github.com/Cyroen/manipesto-util (Branch: main, Commit: 8ca1e9d) [12:58:37.778] VERCEL_FORCE_NO_BUILD_CACHE is set so skipping build cache step [12:58:38.225] Cloning completed: 552.522ms [12:58:38.545] Running "vercel build" [12:58:39.001] Vercel CLI 39.3.0 [12:58:39.337] Installing dependencies... [12:58:57.716] [12:58:57.717] added 422 packages in 18s [12:58:57.718] [12:58:57.718] 145 packages are looking for funding [12:58:57.718] run `npm fund` for details [12:58:57.719] npm notice [12:58:57.719] npm notice New major version of npm available! 10.9.2 -> 11.0.0 [12:58:57.719] npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0 [12:58:57.719] npm notice To update run: npm install -g npm@11.0.0 [12:58:57.720] npm notice [12:58:57.905] Detected Next.js version: 15.1.4 [12:58:57.906] Running "npm run build" [12:58:58.062] [12:58:58.063] > manipesto-util@0.1.0 build [12:58:58.063] > next build [12:58:58.063] [12:58:58.806] Attention: Next.js now collects completely anonymous telemetry regarding usage. [12:58:58.807] This information is used to shape Next.js' roadmap and prioritize features. [12:58:58.807] 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:58:58.808] https://nextjs.org/telemetry [12:58:58.808] [12:58:58.875] ▲ Next.js 15.1.4 [12:58:58.875] [12:58:58.947] Creating an optimized production build ... [12:59:21.874] ✓ Compiled successfully [12:59:21.880] Skipping validation of types [12:59:21.880] Skipping linting [12:59:21.983] Error: Command "npm run build" exited with 1 [12:59:22.440]
Bluetick CoonhoundOP
Latest one
Dwarf Hotot
K
What node version in your local
Bluetick CoonhoundOP
22
Dwarf Hotot
And check on vercel is it same
Bluetick CoonhoundOP
Yeah, 22
I tried other versions
Dwarf Hotot
Did you make any changes while you are setting your project on vercel
Bluetick CoonhoundOP
Environments
Dwarf Hotot
Or just used default selected option
Bluetick CoonhoundOP
That's about it
Dwarf Hotot
Can you do one thing
Bluetick CoonhoundOP
?
Dwarf Hotot
Create new project on vercel again and deploy again and just build for once then tell what happened
Because it just started so you can create again
Bluetick CoonhoundOP
Alright, I'll be right back
Dwarf Hotot
Don't set environment variables just follow the default settings
This can be set after
Bluetick CoonhoundOP
First deployment didn't have environment variables
Dwarf Hotot
K
@Dwarf Hotot Create new project on vercel again and deploy again and just build for once then tell what happened
Bluetick CoonhoundOP
That's the build log
It deployed fine
Dwarf Hotot
Now is it working fine
Bluetick CoonhoundOP
Slowly adding the project files one by one in the new project
Nope
Stil the same error
Dwarf Hotot
Local building
Bluetick CoonhoundOP
Local building has problems with pre-renders now
Dwarf Hotot
Project is running locally
Bluetick CoonhoundOP
with npm dev?
Dwarf Hotot
Yes npm run dev
Bluetick CoonhoundOP
Yeah, runs locally
Dwarf Hotot
Show the build error
Bluetick CoonhoundOP
Dwarf Hotot
Previously I was saying that keep the local project and deploy it again on vercel, don't create new project
Create new deployment on vercel
@Dwarf Hotot Create new project on vercel again and deploy again and just build for once then tell what happened
Bluetick CoonhoundOP
Oh, you said "create new project"
My bad
Dwarf Hotot
Yes keep the same project and deploy another on vercel
Bluetick CoonhoundOP
So like, another github repo?
Dwarf Hotot
Just build for one then tell what happened
No you can use same repo
Just create new project on vercel only and link same repo again
Bluetick CoonhoundOP
AkrigAlright, I'll do that after my laptop does't freeze itself to death
Dwarf Hotot
Yesh that the spirit 😂
@Dwarf Hotot Yesh that the spirit 😂
Bluetick CoonhoundOP
Yeah no, still the same problem
Had to restart my laptop
[14:07:36.661] Running build in Washington, D.C., USA (East) – iad1
[14:07:36.773] Cloning github.com/Cyroen/manipesto-util (Branch: main, Commit: 8ca1e9d)
[14:07:37.129] Previous build cache not available
[14:07:37.212] Cloning completed: 439.798ms
[14:07:37.515] Running "vercel build"
[14:07:38.648] Vercel CLI 39.3.0
[14:07:38.975] Installing dependencies...
[14:07:57.650] 
[14:07:57.651] added 422 packages in 18s
[14:07:57.651] 
[14:07:57.651] 145 packages are looking for funding
[14:07:57.651]   run `npm fund` for details
[14:07:57.872] Detected Next.js version: 15.1.4
[14:07:57.877] Running "npm run build"
[14:07:58.131] 
[14:07:58.131] > manipesto-util@0.1.0 build
[14:07:58.131] > next build
[14:07:58.131] 
[14:07:59.478] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[14:07:59.479] This information is used to shape Next.js' roadmap and prioritize features.
[14:07:59.480] 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:
[14:07:59.480] https://nextjs.org/telemetry
[14:07:59.480] 
[14:07:59.551]    ▲ Next.js 15.1.4
[14:07:59.551] 
[14:07:59.623]    Creating an optimized production build ...
[14:08:21.994]  ✓ Compiled successfully
[14:08:21.998]    Skipping validation of types
[14:08:21.999]    Skipping linting
[14:08:22.099] Error: Command "npm run build" exited with 1
[14:08:22.610] 
I can confirm there's nothing wrong with the packages since I was able to deploy them normally earlier in another project
Dwarf Hotot
localy build is running
Bluetick CoonhoundOP
normally, yes
Dwarf Hotot
share repo
Bluetick CoonhoundOP
Let me public it
public now
Dwarf Hotot
ok testing it locally
Dwarf Hotot
you are not using typescript
Bluetick CoonhoundOP
Really?
I added typescript because of the way I import things like "@/auth.js"
Though, one of my routes is a typescript
Simply followed Next-Auth's docs
Dwarf Hotot
/** @type {import('next').NextConfig} */
const nextConfig = { };

export default nextConfig;
use this nextconfig
Bluetick CoonhoundOP
Alright
[14:37:11.186] Running build in Washington, D.C., USA (East) – iad1
[14:37:11.335] Cloning github.com/Cyroen/manipesto-util (Branch: main, Commit: 82f549f)
[14:37:11.644] Cloning completed: 303.188ms
[14:37:11.694] Previous build cache not available
[14:37:11.962] Running "vercel build"
[14:37:12.460] Vercel CLI 39.3.0
[14:37:12.779] Installing dependencies...
[14:37:31.413] 
[14:37:31.414] added 422 packages in 18s
[14:37:31.414] 
[14:37:31.414] 145 packages are looking for funding
[14:37:31.415]   run `npm fund` for details
[14:37:31.619] Detected Next.js version: 15.1.4
[14:37:31.625] Running "npm run build"
[14:37:31.848] 
[14:37:31.849] > manipesto-util@0.1.0 build
[14:37:31.849] > next build
[14:37:31.849] 
[14:37:33.022] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[14:37:33.022] This information is used to shape Next.js' roadmap and prioritize features.
[14:37:33.023] 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:
[14:37:33.023] https://nextjs.org/telemetry
[14:37:33.023] 
[14:37:33.085]    ▲ Next.js 15.1.4
[14:37:33.086] 
[14:37:33.155]    Creating an optimized production build ...
[14:37:55.150]  ✓ Compiled successfully
[14:37:55.155]    Linting and checking validity of types ...
[14:37:55.290] Error: Command "npm run build" exited with 1
[14:37:55.721] 
Same problem
Dwarf Hotot
are you using env in your project
Bluetick CoonhoundOP
In my project, yes
But it doesn't upload in my github
Dwarf Hotot
Missing Variables: Ensure all environment variables used in your Next.js application are correctly set in your Vercel project settings. Go to your Vercel project dashboard, navigate to "Settings" -> "Environment Variables," and add any required variables.
Variable Names: Double-check that the variable names in your code match the names you've defined in Vercel's settings (case-sensitive).
Bluetick CoonhoundOP
Already did that
Dwarf Hotot
in package.json what is this used for
"engines": {
"node": "22.x"
}
Bluetick CoonhoundOP
setting the specific node version
The default is the latest one i have installed
Dwarf Hotot
can you remove this
and try again
Bluetick CoonhoundOP
I have, I added that to see if it would fix it
With it removed or being there had the same error
It has something to do with one of my scripts but god knows which one
Dwarf Hotot
page scripts
Bluetick CoonhoundOP
The ones under api?
Dwarf Hotot
ok i think i found something

in the api folder if you create api the file name should be always route.ts not route.js
Bluetick CoonhoundOP
I renamed it to route js
Dwarf Hotot
so change every api route to route.ts
Bluetick CoonhoundOP
Oh, I read that wrong
Wait
Dwarf Hotot
ok
Bluetick CoonhoundOP
If I change it to ts, will I have to change the scripts?
Dwarf Hotot
first remove the auth api because it is empty
and for rest just change the file name to route.ts
Bluetick CoonhoundOP
Oh, I use the auth api
Followed the Next-Auth docs and they specified that folder names specifically for some reason
Dwarf Hotot
but the auth file is empty so remove it
Bluetick CoonhoundOP
Well, not really empty but close enough
it's just a shortcut of the auth.js
Which is this
Dwarf Hotot
i think you follwed wrong step
remove this auth.js file
and change the route.ts to route.js
in your api file
Bluetick CoonhoundOP
All the routes?
Dwarf Hotot
yes change all api routes name to route.js
and remove this auth.js in your src folder
Bluetick CoonhoundOP
Done, gonna try building again
Dwarf Hotot
build it
Bluetick CoonhoundOP
[15:20:47.321] Running build in Washington, D.C., USA (East) – iad1
[15:20:49.387] Cloning github.com/Cyroen/manipesto-util (Branch: main, Commit: 9dca453)
[15:20:49.395] VERCEL_FORCE_NO_BUILD_CACHE is set so skipping build cache step
[15:20:49.759] Cloning completed: 367.945ms
[15:20:50.147] Running "vercel build"
[15:20:50.597] Vercel CLI 39.3.0
[15:20:50.929] Installing dependencies...
[15:21:23.879] Failed to compile.
[15:21:23.879] 
[15:21:23.879] ./src/app/actions/index.js
[15:21:23.879] Module not found: Can't resolve '../../../auth'
[15:21:23.880] 
[15:21:23.880] https://nextjs.org/docs/messages/module-not-found
[15:21:23.880] 
[15:21:23.880] Import trace for requested module:
[15:21:23.880] ./node_modules/next/dist/build/webpack/loaders/next-flight-action-entry-loader.js?actions=%5B%5B%22%2Fvercel%2Fpath0%2Fsrc%2Fapp%2Factions%2Findex.js%22%2C%5B%5B%22000c28efa5911bf822c2e1880aad1e2f923d974141%22%2C%22doLogout%22%5D%2C%5B%2240cc374c6f13d9c2e1421e70933759e4a1e838adf2%22%2C%22doSocialLogin%22%5D%5D%5D%5D&__client_imported__=true!
[15:21:23.880] 
[15:21:23.881] ./src/app/api/auth/[...nextauth]/route.js
[15:21:23.881] Module not found: Can't resolve '../../../../../auth'
[15:21:23.881] 
[15:21:23.881] https://nextjs.org/docs/messages/module-not-found
[15:21:23.888] 
[15:21:23.888] ./src/app/home/page.js
[15:21:23.888] Module not found: Can't resolve '../../../auth'
[15:21:23.888] 
[15:21:23.888] https://nextjs.org/docs/messages/module-not-found
[15:21:23.888] 
[15:21:23.896] 
[15:21:23.896] > Build failed because of webpack errors
[15:21:23.929] Error: Command "npm run build" exited with 1
[15:21:24.366] 
Got more problems now since auth.js was being used
Dwarf Hotot
auth remove this in api folder
because it is empty
Bluetick CoonhoundOP
Oh, you meant the auth folder, not auth.js
Dwarf Hotot
auth also and auth.js also
both
Bluetick CoonhoundOP
auth js is being used so gonna have to change up the scripts for that one
It doesn't make sense though, docs said to use it that way specifically
Still the same problem
Dwarf Hotot
locally building
Bluetick CoonhoundOP
Local building works fine as usual
Dwarf Hotot
what are the features you are using like next auth or any thing else
Bluetick CoonhoundOP
It's all in the package json
That's the only things I'm using
Dwarf Hotot
share the build logs
failing one
Bluetick CoonhoundOP
[15:02:40.589] Running build in Washington, D.C., USA (East) – iad1
[15:02:40.696] Cloning github.com/Cyroen/manipesto-util (Branch: main, Commit: 1742edb)
[15:02:40.707] VERCEL_FORCE_NO_BUILD_CACHE is set so skipping build cache step
[15:02:41.054] Cloning completed: 358.366ms
[15:02:42.037] Running "vercel build"
[15:02:42.469] Vercel CLI 39.3.0
[15:02:43.007] Installing dependencies...
[15:03:01.190] 
[15:03:01.190] added 422 packages in 18s
[15:03:01.191] 
[15:03:01.191] 145 packages are looking for funding
[15:03:01.191]   run `npm fund` for details
[15:03:01.519] Detected Next.js version: 15.1.4
[15:03:01.526] Running "npm run build"
[15:03:02.181] 
[15:03:02.182] > manipesto-util@0.1.0 build
[15:03:02.182] > next build
[15:03:02.182] 
[15:03:03.289] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[15:03:03.290] This information is used to shape Next.js' roadmap and prioritize features.
[15:03:03.293] 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:
[15:03:03.293] https://nextjs.org/telemetry
[15:03:03.294] 
[15:03:03.357]    ▲ Next.js 15.1.4
[15:03:03.358] 
[15:03:03.427]    Creating an optimized production build ...
[15:03:25.201]  ✓ Compiled successfully
[15:03:25.206]    Linting and checking validity of types ...
[15:03:25.334] Error: Command "npm run build" exited with 1
[15:03:25.907] 
Quite very much the same thing
Dwarf Hotot
in tsconfig.json
"src/app/auth.js", "src/app/api/auth/[...nextauth]/route.js", "src/app/api/t/route.js", "src/app/api/g/route.ts" ],

why you have use it here
Bluetick CoonhoundOP
Which one?
Oh, that one
It's because when I try to import using "@/", it gives me an error
Let me try removing it
Dwarf Hotot
Ok so do one thing create a new project on your local and dont add anything just build on vercel
create new nextjs project and just deploy on vercel
Bluetick CoonhoundOP
I did that earlier and it built fine
Both local and vercel
I added the src folder and the problem appeared
[Same src folder from the original project]
Dwarf Hotot
so now add one by one file not the whole folder
Bluetick CoonhoundOP
Alright, gonna take me a long-ass while but worth the try
Dwarf Hotot
yes and every time deploy on vercel
after every file addition
@Dwarf Hotot yes and every time deploy on vercel
Bluetick CoonhoundOP
Found the culprit
Tsconfig.json
Deleted and now it's finally working
Thanks again, Anshu
Dwarf Hotot
Welcome
lets become friends
i like connecting developers