Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing a npm package with a bin populated by a postinstall script doesn't work #26677

Closed
jgoux opened this issue Nov 1, 2024 · 1 comment · Fixed by #26752
Closed

Installing a npm package with a bin populated by a postinstall script doesn't work #26677

jgoux opened this issue Nov 1, 2024 · 1 comment · Fixed by #26752
Assignees
Labels
bug Something isn't working correctly install

Comments

@jgoux
Copy link

jgoux commented Nov 1, 2024

Version: Deno 2.0.4

Hello folks,

I'm giving Deno a spin as my main development tool to replace node/npm. I'm trying to run Supabase CLI with it and failing.

I have a package.json:

{
  "devDependencies": {
    "supabase": "^1.207.9"
  }
}

Then doing :

deno install --allow-scripts

And here is the output:

Warning Trying to set up 'supabase' bin for "/Users/jgoux/Code/supabase-workflows/node_modules/.deno/[email protected]/node_modules/supabase", but the entry point "/Users/jgoux/Code/supabase-workflows/node_modules/.deno/[email protected]/node_modules/supabase/bin/supabase" doesn't exist.

I think the issue is that the symlinks get only created before the postinstall scripts run, which is an issue for CLI that get downloaded in postinstall scripts like Supabase one.

Another issue is that even if I create the symlink myself, deno run is failing:

ln -s /Users/jgoux/Code/supabase-workflows/node_modules/supabase/bin/supabase node_modules/.bin/supab
ase
deno run -A supabase --version

Output:

error: Is a directory (os error 21)

For this one I suppose it's because in a regular Supabase project, you create a supabase directory at the root of your project. And deno run is prioritizing this folder over the binary in node_modules/.bin/supabase.
To resolve this it would be better to priorize binaries over folders, or have a dedicated exec subcommand to run binaries explicitly?

@nathanwhit
Copy link
Member

nathanwhit commented Nov 5, 2024

Thanks for reporting! I can reproduce the issue and confirmed it's something we should handle. I've opened a PR that should resolve the issue.

With regards to this part:

Another issue is that even if I create the symlink myself, deno run is failing:

It's not at all clear from the error message, but we don't currently support running binaries provided by npm dependencies in that way. You can run them directly like

./node_modules/.bin/supabase --version

or we support running binaries via scripts, so you can work around this with a script like

{
   "scripts": {
      "supabase": "supabase"
    }
}

and then execute it with

deno task supabase --version

or

# note that this is running the script, which runs the binary
deno run supabase --version

Though I agree that it would be good to have something like npm exec for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly install
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants