D
Dokploy10mo ago
Tony

Deploy NextJs Issue

Hi, I justy start to use dokploy to deploy nextjs application. I encounter a problem. My Frontend Nextjs project use PNPM and when I click the deploy button, it meets failure. Can you help me debug this error? Error Message #10 [stage-0 6/10] RUN --mount=type=cache,id=oTFgebIbq8s-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile #10 0.668  WARN  Ignoring not compatible lockfile at /app/pnpm-lock.yaml #10 0.672  ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent #10 0.672 #10 0.672 Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile" #10 ERROR: process "/bin/bash -ol pipefail -c pnpm i --frozen-lockfile" did not complete successfully: exit code: 1 ------
[stage-0 6/10] RUN --mount=type=cache,id=oTFgebIbq8s-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile:
0.668  WARN  Ignoring not compatible lockfile at /app/pnpm-lock.yaml 0.672  ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent 0.672 0.672 Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile" ------ Dockerfile:20 -------------------- 18 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH 19 | COPY . /app/. 20 | >>> RUN --mount=type=cache,id=oTFgebIbq8s-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile 21 |
22 | # build phase -------------------- ERROR: failed to solve: process "/bin/bash -ol pipefail -c pnpm i --frozen-lockfile" did not complete successfully: exit code: 1 Error: Docker build failed Error response from daemon: No such container: image-service-frontend-nextjs-7366b0-tJU7Rv4mFU Error ❌
No description
89 Replies
Siumauricio
Siumauricio10mo ago
I think the issue is clear  ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent
Tony
TonyOP10mo ago
Thank you for your reply. Can you tell me what should I do to fix this bug?
Siumauricio
Siumauricio10mo ago
what version of pnpm are you using?
Tony
TonyOP10mo ago
Sorry, I don't know how to check my version of pnpm How can I confirm
Siumauricio
Siumauricio10mo ago
We have a simple example of nextjs check this https://github.com/Dokploy/examples/tree/main/nextjs
GitHub
examples/nextjs at main · Dokploy/examples
Examples to deploy on Dokploy. Contribute to Dokploy/examples development by creating an account on GitHub.
Tony
TonyOP10mo ago
ok, I will check this out, thx! I use a github provider, Now I will try the git provider.
Siumauricio
Siumauricio10mo ago
do you have a public repo of the project you want to deploy?
Tony
TonyOP10mo ago
it is a private one. I try the git deploy method, still the same error 🥺
Siumauricio
Siumauricio10mo ago
looks like the pnpm lock file is absent
Tony
TonyOP10mo ago
Kind of weird, I can see it. And I deploy to vercel successfully
No description
Siumauricio
Siumauricio10mo ago
show how did you configure the github repo in the application
Tony
TonyOP10mo ago
Here is my configuration
No description
Siumauricio
Siumauricio10mo ago
show your package json
Tony
TonyOP10mo ago
{ "name": "luma-ai-eng", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "prisma generate && next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@aws-sdk/client-s3": "^3.598.0", "@clerk/nextjs": "^5.1.5", "@headlessui/react": "^2.0.4", "@heroicons/react": "^2.1.3", "@hookform/resolvers": "^3.6.0", "@prisma/client": "5.16.2", "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-label": "^2.0.2", "@radix-ui/react-radio-group": "^1.1.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-switch": "^1.0.3", "@stripe/stripe-js": "^3.5.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "dayjs": "^1.11.11", "embla-carousel-react": "^8.1.4", "jotai": "^2.9.0", "lucide-react": "^0.394.0", "nanoid": "^5.0.7", "next": "14.2.4", "next-themes": "^0.3.0", "next-view-transitions": "^0.2.0", "openai": "^4.52.0", "react": "^18", "react-dom": "^18", "react-hook-form": "^7.52.0", "react-hot-toast": "^2.4.1", "react-tweet": "^3.2.1", "sonner": "^1.5.0", "stripe": "^15.12.0", "svix": "^1.24.0", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", "zod": "^3.23.8" }, "devDependencies": { "@tailwindcss/typography": "^0.5.13", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.2.4", "postcss": "^8", "prisma": "5.15.0", "tailwindcss": "^3.4.1", "typescript": "^5" } }
Siumauricio
Siumauricio10mo ago
can you do pnpm -v
Tony
TonyOP10mo ago
pnpm -v
9.5.0 it is 9.5.0 in My Project Vscode Terminal
Siumauricio
Siumauricio10mo ago
that's the reason nixpacks doesnt support pnpm 9, can you try to use heroku buildpacks in the builder?
Tony
TonyOP10mo ago
Hi, what is the difference between these buildpacks? Is it the same for nextjs ?
Siumauricio
Siumauricio10mo ago
yeah is the same, they just do a different build process internally
Tony
TonyOP10mo ago
Okay, I am trying to use heroku buildpacks Seems like npm works great.
Siumauricio
Siumauricio10mo ago
or if you want to use nixpacks 1. create a file call nixpacks.toml 2. Paste this code in the file
providers = ["node"]

[phases.install]
cmds = ["npm install -g corepack", "corepack enable", "corepack prepare [email protected] --activate", "pnpm install"]
providers = ["node"]

[phases.install]
cmds = ["npm install -g corepack", "corepack enable", "corepack prepare [email protected] --activate", "pnpm install"]
3. Push to github
Tony
TonyOP10mo ago
No description
Tony
TonyOP10mo ago
Okay, I will try it addiung nixpacks.toml resolution
Tony
TonyOP10mo ago
It work! You are a legend
No description
Tony
TonyOP10mo ago
How can I support you? You may help me save hundreds of vercel billings. It really means a lot
Siumauricio
Siumauricio10mo ago
If you would like to support me, it would be great and much appreciated. https://github.com/sponsors/Siumauricio or https://opencollective.com/dokploy
GitHub
Sponsor @Siumauricio on GitHub Sponsors
Support Siumauricio's open-source work on Dokploy, a user-friendly alternative to Heroku, Vercel, and Netlify. Enhance your deployment experience with innovative solutions.
Dokploy - Open Collective
Dokploy is an open source alternative to Vercel, Heroku, Netlify.
Tony
TonyOP10mo ago
I have sponsored 5$ for you! Nice work
No description
Tony
TonyOP10mo ago
Can I ask what are the notes for deploying nextjs? Or are there any common O&M issues, I can pay for it.
Siumauricio
Siumauricio10mo ago
Wow really thank you! appreciated! Not really, that's all you have to do, what I would recommend is to build your project and upload a docker image to dockerhub and then in dokploy just download it and run it.
Tony
TonyOP10mo ago
Just want to ask another question. How can I add domain. I added dream.runningdogg.com in Cloudfalre and dokploy. I add the dns record to point to the Server Ip. But I can not visit it
Siumauricio
Siumauricio10mo ago
in the domains tab
No description
Tony
TonyOP10mo ago
DO you recommend using DockerImage to build my project? Instead of using builder
Tony
TonyOP10mo ago
No description
Tony
TonyOP10mo ago
I can see the domain
Tony
TonyOP10mo ago
No description
Tony
TonyOP10mo ago
This is my dns setting, Is it anything wrong?
Siumauricio
Siumauricio10mo ago
edit the domain and in the port set port 3000 and disable https
Tony
TonyOP10mo ago
got it
Siumauricio
Siumauricio10mo ago
Yes what are the resources of your vps?
Tony
TonyOP10mo ago
Hetzner, I watch your youtube video and bought it
Siumauricio
Siumauricio10mo ago
Nice, that's the best and how much are you paying for it?
Tony
TonyOP10mo ago
Strill 502 error, do not know why
Siumauricio
Siumauricio10mo ago
did you disabled the https and set port 3000?
Tony
TonyOP10mo ago
I am paying the 12 plan, no shared cpu beacuse I want all the vercel projects to be deployed on Hetzner
Tony
TonyOP10mo ago
Yes
No description
Siumauricio
Siumauricio10mo ago
ohh that's the good one, I'm paying for that aswell
Tony
TonyOP10mo ago
8G plan right? I do not know if it is enough, but it seems enough for me
Siumauricio
Siumauricio10mo ago
in the content of the A record you set the ip right?
Tony
TonyOP10mo ago
Yes Server IP
Tony
TonyOP10mo ago
No description
Siumauricio
Siumauricio10mo ago
that's the reasson
Tony
TonyOP10mo ago
This is my SSL config on CF
Siumauricio
Siumauricio10mo ago
I was going to ask for that set in flexible
Tony
TonyOP10mo ago
Got it, Before I host on vercel, it seems to be FULL I will try it
Siumauricio
Siumauricio10mo ago
Ok, let me knwo if its work
Tony
TonyOP10mo ago
No description
Tony
TonyOP10mo ago
I make it flexible, but it meets another error
Tony
TonyOP10mo ago
No description
Siumauricio
Siumauricio10mo ago
just close it, try access to your website looks like is working now https://dream.runningdogg.com/
Tony
TonyOP10mo ago
Still can not visit it. I visit the dokploy vis domain names, I can not login right now weird
Siumauricio
Siumauricio10mo ago
yeah is because you changed the SSL mode
Tony
TonyOP10mo ago
DO I need to change back to FULL?
Siumauricio
Siumauricio10mo ago
Yeah
Tony
TonyOP10mo ago
If I switch into FULL mode, I can visit my dokploy page. But still can not visit the domain
Tony
TonyOP10mo ago
No description
Siumauricio
Siumauricio10mo ago
Ok, so in the domain activate the https and select letsencrypt
Tony
TonyOP10mo ago
seems like the same error
No description
Siumauricio
Siumauricio10mo ago
No description
Tony
TonyOP10mo ago
Sorry to ask so many questions. If I need to add env to my project, do I need to redeploy?
Siumauricio
Siumauricio10mo ago
yes
Tony
TonyOP10mo ago
GOT it , I will retry Weird.. the auto-generation domain seems to work. But The browser strill reminds it is not safe. And dream.runningdogg.com seems not to work
Siumauricio
Siumauricio10mo ago
In my case I see the https version butt if you want to force the https you can do in cloudflare
Tony
TonyOP10mo ago
okay, I will restart the browser. Thanks so much for your support If I can use dokploy to host my project, I will donate another 10$ for your work. Legend
Siumauricio
Siumauricio10mo ago
Really thank you!! apreciated man, let me know if you have another questions
Tony
TonyOP10mo ago
Got you Bye~
Tony
TonyOP10mo ago
Oh , It really works!!!!! Seems like I can not pay another one-time payment. Big Thanks Bro .
No description
Siumauricio
Siumauricio10mo ago
🥲 Github issues
Tony
TonyOP9mo ago
hi can i ask another question here? I want to deploy , not after I push to github , I want it like vercel --prod. Does Dokploy has that function?
Siumauricio
Siumauricio9mo ago
In my case I have three different projects project-develop, project-staging, project-staging and when you merge changes in GitHub in the specific branch you can automatize the deployment to specific branch
Tony
TonyOP9mo ago
hi Just want to ask another question~ which package manager do you recommend? npm or pnpm? Which one do you prefer? I use pnpm, and I don't know if it is best
Siumauricio
Siumauricio9mo ago
Pnpm
Freilyn Bernabe
Freilyn Bernabe9mo ago
True, more fast
Tony
TonyOP9mo ago
thanks! I want to ask another question, After deploying 1 nextjs object, i find out that it tasks about 8.5 GB Space. SO My question is, is it always 7-8 GB per project ? Beacuse I bought a server with 16gb Memory and 160GB Space. And I am not certain if the sever can host many projects the same time. @Siumauricio and is it safe to use clean all option?
Tony
TonyOP9mo ago
No description
Freilyn Bernabe
Freilyn Bernabe9mo ago
Yes is so safe clean all and is not 7-8GB per project
Freilyn Bernabe
Freilyn Bernabe9mo ago
I have several projects and only 12GB, take into account the docker containers.
No description
No description
Tony
TonyOP9mo ago
@Freilyn Bernabe thank you!

Did you find this page helpful?