CLI not working with yarn 3.6.4 or yarn 4.0.1 on Windows
Describe the bug Unable to run CLI when using latest stable versions of yarn 3 or 4
Tried with latest stable (4.0.2) and then 3.6.4 (https://github.com/supabase/cli/issues/1380)
Deleted yarn.lock/.yarn/.pnp.*
To Reproduce
- Open terminal
- Run
yarn supabase -h
Full repro:
# yarn 3
mkdir test-yarn3 && cd test-yarn3 && yarn init -y && yarn set version 3.6.4 && yarn add -D supabase && yarn supabase -h
# yarn 4
mkdir test-yarn4 && cd test-yarn4 && yarn init -y && yarn set version 4.0.2 && yarn add -D supabase && yarn supabase -h
Expected behavior
CLI's help screen
Screenshots
$ node -v
v19.6.0
$ yarn -v
4.6.4
$ yarn supabase -h
G:\dev\proj-15-demo\.pnp.cjs:28556
return Object.defineProperties(new Error(message), {
^
Error: Qualified path resolution failed: we looked for the following paths, but none could be accessed.
Source path: G:\dev\proj-15-demo\.yarn\unplugged\supabase-npm-1.110.2-8a9a0308b6\node_modules\supabase\bin\supabase
Not found: G:\dev\proj-15-demo\.yarn\unplugged\supabase-npm-1.110.2-8a9a0308b6\node_modules\supabase\bin\supabase
at makeError (G:\dev\proj-15-demo\.pnp.cjs:28556:34)
at resolveUnqualified (G:\dev\proj-15-demo\.pnp.cjs:30328:13)
at resolveRequest (G:\dev\proj-15-demo\.pnp.cjs:30369:14)
at Object.resolveRequest (G:\dev\proj-15-demo\.pnp.cjs:30425:26)
at resolve$1 (file:///G:/dev/proj-15-demo/.pnp.loader.mjs:1989:21)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:416:18)
at ESMLoader.import (node:internal/modules/esm/loader:517:22)
at node:internal/modules/run_main:56:28
Node.js v19.6.0
Desktop (please complete the following information):
- OS: Windows 10
- Version of CLI v1.106.1
- Version of supabase-js v2.38.4
- Version of Node.js v19.6.0
Additional context
Works as expected on Linux with Docker (e.g. docker run --rm --workdir=/tmp -it node:slim bash)
Works like a charm for me on OSX. Most likely something with the Windows env, but don't have a VM at hand to test this.
Thanks for the test. After updating my issue with Docker and Linux and now macOS, clearly seems like an issue with Windows.
Repro available with CircleCI + Windows: https://github.com/bre7/supabase-1624 https://app.circleci.com/pipelines/github/bre7/supabase-1624/1/workflows/4e590083-1e5c-4013-b07c-58dfe234fbc9/jobs/1
Update: Not sure what happened but now it's working on my win PC. Still not working on CI vm.
Are there any updates to this issue ?
There a couple of issues that lead to this problem with yarn 4 on windows
- Yarn 4 no longer looks up binaries in
node_modules/.bindirectory. - Node doesn't execute extensionless
binpath in package.json on windows.
This is complicated to solve because we use the same package.json for Linux / macOS which support extensionless binary paths.
Previously we workaround no. 2 by adding a symlink to node_modules/.bin on windows but due to no. 1 this is no longer viable.
Until we find a way to update yarn's bin path from postinstall, you won't be able to use yarn supabase commands. Instead, you will have to invoke the binary directly from its installation directory. Powershell example:
& "$(yarn bin supabase).exe" --version
Note the leading & character.