cli icon indicating copy to clipboard operation
cli copied to clipboard

"'supabase' is not recognized as an internal or external command, operable program or batch file" error when trying to install Supabase CLI on Windows via pnpm for the Next.js Subscription Payments Starter project

Open rokbenko opened this issue 1 year ago • 11 comments

Hi! I have issues when trying to install Supabase CLI on Windows.

I'm trying to set up Next.js Subscription Payments Starter project.

I was getting the following error after running pnpm supabase:start:

> @ supabase:start C:\Users\xxxxx\xxxxx
> npx supabase start

'supabase' is not recognized as an internal or external command,
operable program or batch file.
ELIFECYCLE  Command failed with exit code 1.

Therefore, I ran the following command:

pnpm install supabase@latest --save-dev

This installed Supabase version 2.2.1.

Then I tried to run pnpm supabase:start again, but I'm still getting the same error:

> @ supabase:start C:\Users\xxxxx\xxxxx
> npx supabase start

'supabase' is not recognized as an internal or external command,
operable program or batch file.
ELIFECYCLE  Command failed with exit code 1.

However, there was a warning when I ran pnpm install supabase@latest --save-dev which I think is the cause of the issue:

WARN  Failed to create bin at C:\Users\xxxxx\xxxxx\node_modules\.pnpm\[email protected]\node_modules\supabase\node_modules\.bin\supabase. ENOENT: no such file or directory, stat 'C:\Users\xxxxx\xxxxx\node_modules\.pnpm\[email protected]\node_modules\supabase\bin\supabase.EXE'
WARN  Failed to create bin at C:\Users\xxxxx\xxxxx\node_modules\.pnpm\[email protected]\node_modules\supabase\node_modules\.bin\supabase. ENOENT: no such file or directory, stat 'C:\Users\xxxxx\xxxxx\node_modules\.pnpm\[email protected]\node_modules\supabase\bin\supabase.EXE'
pabase. ENOENT: no such file or directory, stat 'C:\Users\xxxxx\xxxxx\node_modules\.pnpm\[email protected]\node_modules\supabase\bin\supabase.EXE'

How can I solve the issue?

rokbenko avatar Jan 09 '25 10:01 rokbenko

Solved by installing Supabase CLI outside of the Next.js Subscription Payments Starter project but without the -g flag:

npm install supabase

If anyone knows why this solved the issue, please let me know.

rokbenko avatar Jan 09 '25 16:01 rokbenko

I encountered the same issue on Windows. Following the Supabase documentation's suggestion to install via Scoop resolved the problem for me.

scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabase

tungdn3 avatar Mar 15 '25 15:03 tungdn3

I have faced the same issue, and I have added 'npx' to any 'supabase' command as the prefix

chandima2000 avatar Apr 17 '25 06:04 chandima2000

I was facing the same issue, but then I switched to yarn and now everything is working fine! It looks like there are issues with the global installation of Supabase CLI via pnpm.

mattvalgreen avatar Apr 21 '25 22:04 mattvalgreen

using pnpm and seeing this issue.

th-m avatar Apr 25 '25 21:04 th-m

Ditto - same issue via pnpm

hortonal avatar Apr 28 '25 17:04 hortonal

To anyone having issues with PNPM + Supabase CLI, read this:

Supabase CLI relies on a "postinstall" script, which the latest versions of PNPM do not automatically run unless you set dangerouslyAllowAllBuilds: true in your .npmrc or pnpm-workspace.yaml file. (Note that syntax is a bit different for .npmrc).

Of course, that setting is potentially dangerous. You probably want to set onlyBuiltDependencies: ["supabase"] instead. But note that other dependencies, like esbuild, may also need to be added there.

aleclarson avatar Jun 15 '25 03:06 aleclarson

Having the worst case scenario installing supabase CLI. Tried npm, nnpm, scoop, neither of them is working on my windows 11

xheenkhalil avatar Nov 05 '25 13:11 xheenkhalil

Solution:

With pnpm v10 (latest version at the time of writing), you can resolve this by running:

pnpm approve-builds  

Select supabase when prompted and confirm.

The postinstall script should now run successfully.

JasonKoolman avatar Nov 06 '25 20:11 JasonKoolman

I got stuck in same thing for some time and pnpm approve-builds did not work. Then i removed node_modules folder and ran pnpm install. Then pnpm approve-builds worked. Putting it here, just in case someone struggling like me.

nikhiljohn10 avatar Feb 21 '26 10:02 nikhiljohn10

I am sill facing this issue

mayank1513 avatar Apr 13 '26 16:04 mayank1513