coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
26.49k stars 1.35k forks source link

[Bug]: application with Nixpacks and pnpm v9+ #2250

Open gBusato opened 1 month ago

gBusato commented 1 month ago

Description

Hey guys,

I was having some trouble deploying a NextJS application using Nixpacks and pnpm v9.1.0 as package manager.

The typical error while deploying was happening during the pnpm install :

ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent

After some research, I found out that currently ( 2024/05/20 ) Nixpack doesn't support pnpm v9.0+ and only v8.0.

One of the solution is to downgrad your pnpm version, but I couldn't due to some other projects running on pnpm v9.0.

Well I did found a solution on this github post.

Here are the steps to make it work :

  1. Create a Nixpacks configuration file at the root of your projet
  2. Add the following code inside the file
    
    providers = ["node"]

[phases.install] cmds = ["npm install -g corepack", "corepack enable", "corepack prepare pnpm@9.1.0 --activate", "pnpm install"]


3. deploy and enjoy

With the Nixpacks file forcing the install of pnpm v9.1 it should work. Also replace version 9.1.0 with your current running version at the time you are looking at the solution 

I hope it will helps some of you ! Have fun and happy coding

### Minimal Reproduction (if possible, example repository)

Having any node js project and pnpm v9.0+ has current package manager and a pnpm-lock.yaml file with `lockfileVersion: '9.0'` or higher

### Exception or Error

`ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent
`

### Version

v4.0.0
fcpauldiaz commented 1 month ago

I fixed this by adding this to the package.json

"packageManager": "pnpm@9.1.1"
GifCo commented 1 month ago

I fixed this by adding this to the package.json

"packageManager": "pnpm@9.1.1"

THanks for this! Worked for me.

This is beyond ridiculous that this is not in the doc's and or automated.