cli icon indicating copy to clipboard operation
cli copied to clipboard

supabase-cli installation via pnpm is broken

Open duongphuhiep opened this issue 1 year ago • 14 comments

Describe the bug

supabase-cli installation via pnpm is broken

To Reproduce Follow the quick start docs using pnpm

  1. pnpm add supabase --save-dev
WARN  Failed to create bin at /node_modules/.bin/supabase. ENOENT: no such file or directory, open '/node_modules/.pnpm/[email protected]/node_modules/supabase/bin/supabase'
  1. pnpm supabase --version
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "supabase" not found

Expected behavior

``pnpm supabase` should work

Screenshots I

Image

System information Rerun the failing command with --create-ticket flag.

  • Ticket ID:
  • Version of OS: Fedora Linux 42
  • Version of CLI: 2.22.6
  • Version of Docker: Podman 5.4.2
  • Versions of services:

Additional context If applicable, add any other context about the problem here.

  • Browser Chrom
  • Version of supabase-js v2.22.6
  • Version of Node.js 23.11.0

duongphuhiep avatar Apr 26 '25 06:04 duongphuhiep

It's likely your pnpm doesn't have permission to create directories in the directory it mentioned. This isn't a CLI issue, it's more of a pnpm and your operating system issue. I use pnpm for most of my projects with the CLI and have never encountered this issue before. This is both on Windows and Ubuntu.

silentworks avatar Apr 26 '25 22:04 silentworks

unlikely, the error seem to tell that pnpm was unable to create a link to the supabase executable to the bin folder because it couldn't find it in the original [email protected] folder.

In fact, I'm not the only one encounter the problem: https://github.com/supabase/cli/issues/3026#issuecomment-2819590490

duongphuhiep avatar Apr 26 '25 23:04 duongphuhiep

I also see have the same issue as of today. pnpm install was previous fine. I now get similar:  WARN  Failed to create bin at [project_dir]\node_modules\.pnpm\node_modules\.bin\supabase. ENOENT: no such file or directory, stat '[project_dir]\node_modules\.pnpm\node_modules\supabase\bin\supabase.EXE'  WARN  Failed to create bin at [project_dir]\services\database\node_modules\.bin\supabase. ENOENT: no such file or directory, stat '[project_dir]\node_modules\.pnpm\[email protected]\node_modules\supabase\bin\supabase.EXE'

hortonal avatar Apr 28 '25 17:04 hortonal

I just ran the command provided in the OP and I got the warning message but when I ran pnpm supabase it all worked as expected. I'm using WSL2 Ubuntu. The warning has always been there from what I can remember but it installs the package after that with the postinstall script.

Image

silentworks avatar Apr 28 '25 19:04 silentworks

Confirming, this seems to be broken since v2.22.6

pnpm dlx [email protected] works as expected, pnpm dlx [email protected] fails with  ENOENT  Command failed with ENOENT: supabase

acgray avatar Apr 29 '25 13:04 acgray

Image

Same issue using pnpm On my machine and vercel

bennajah avatar May 12 '25 20:05 bennajah

@silentworks

It's likely your pnpm doesn't have permission to create directories in the directory it mentioned. This isn't a CLI issue, it's more of a pnpm and your operating system issue. I use pnpm for most of my projects with the CLI and have never encountered this issue before. This is both on Windows and Ubuntu.

This issue happen when deploy to vercel too

bennajah avatar May 12 '25 20:05 bennajah

pnpm added a new security measure which you have to manually approve of executable when calling them from the terminal. I believe this is what is causing this issue.

silentworks avatar May 13 '25 19:05 silentworks

@silentworks

pnpm added a new security measure which you have to manually approve of executable when calling them from the terminal. I believe this is what is causing this issue.

How ?

bennajah avatar May 13 '25 19:05 bennajah

@bennajah you now have to approve builds with pnpm. You can see the warning here in my project and it says I should run pnpm approve-builds manually before the CLI will be functional. This change was made somewhere in v10 of pnpm.

Image

silentworks avatar May 13 '25 20:05 silentworks

pnpm approve-builds , then approve supabase worked for me

znadir avatar May 14 '25 14:05 znadir

pnpm approve-builds , then approve supabase worked for me

Same here. In my case, I had to pnpm install --force the existing project to properly reinstall everything and then be prompted with the "approve-builds" warning.

twekz avatar May 16 '25 12:05 twekz

This is an upstream issue with pnpm with a known workaround

pnpm add supabase --save-dev --allow-build=supabase

https://github.com/pnpm/pnpm/issues/9124#issuecomment-2663021284

sweatybridge avatar May 23 '25 14:05 sweatybridge

this worked for me . pnpm 10+

rm -rf node_modules/.pnpm/supabase* && pnpm remove supabase && pnpm add -D supabase

sacsand avatar Dec 12 '25 19:12 sacsand