"'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
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?
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.
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
I have faced the same issue, and I have added 'npx' to any 'supabase' command as the prefix
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.
using pnpm and seeing this issue.
Ditto - same issue via pnpm
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.
Having the worst case scenario installing supabase CLI. Tried npm, nnpm, scoop, neither of them is working on my windows 11
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.
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.
I am sill facing this issue