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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

commander is outdated #299

Open
jtzero opened this issue Jun 28, 2022 · 7 comments
Open

commander is outdated #299

jtzero opened this issue Jun 28, 2022 · 7 comments
Labels

Comments

@jtzero
Copy link

jtzero commented Jun 28, 2022

馃悰 Bug Report

when I install a plugin meta can find the source of the plugin but not the bin.

To Reproduce

  • docker container: docker run -it node:18-bullseye /bin/bash
  • install meta globally: npm install -g meta
  • install a plugin globally: npm install -g meta-search
  • set debug: export DEBUG=*
  • run command: meta search
  • result: it will find the lib for meta-search yet not the bin
  root@8e6eb90be27e:/# meta search
  meta
  meta Resolving plugins: +0ms
  meta   /node_modules +1ms
  meta   /usr/local/lib/node_modules +283ms
  meta     + meta-bump +1ms
  meta     + meta-project +0ms
  meta     + meta-search +0ms
  meta
  meta Loading plugins: +0ms
  meta   + meta-bump /usr/local/lib/node_modules/meta-bump +0ms
  meta   + meta-project /usr/local/lib/node_modules/meta-project +1ms
  meta   + meta-search /usr/local/lib/node_modules/meta-search +1ms
  meta
  meta Loading core plugins: +3ms
  meta   + meta-git /usr/local/lib/node_modules/meta/node_modules/meta-git +0ms
  meta   + meta-init /usr/local/lib/node_modules/meta/node_modules/meta-init +1ms
  meta   + meta-loop /usr/local/lib/node_modules/meta/node_modules/meta-loop +41ms
  meta   + meta-project (skip) +42ms
  find-module-bin looking for meta-search at /node_modules/.bin/meta-search +0ms
  find-module-bin looking for meta-search at /usr/local/lib/node_modules/.bin/meta-search +0ms
  find-module-bin looking for meta-search at /usr/lib/node_modules/.bin/meta-search +0ms
  find-module-bin looking for meta-search at /usr/local/lib/node_modules/meta/bin/node_modules/.bin/meta-search +0ms
  find-module-bin looking for meta-search at /usr/local/lib/node_modules/meta/node_modules/.bin/meta-search +0ms
  find-module-bin looking for meta-search at /usr/local/node_modules/.bin/meta-search +0ms
  find-module-bin looking for meta-search at /usr/node_modules/.bin/meta-search +1ms
Error: could not find meta-search
    at findModuleBin (/usr/local/lib/node_modules/meta/node_modules/find-module-bin/lib/index.js:18:9)
    at Command.executeSubCommand (/usr/local/lib/node_modules/meta/node_modules/commander/index.js:552:11)
    at Command.parse (/usr/local/lib/node_modules/meta/node_modules/commander/index.js:489:17)
    at exports.run (/usr/local/lib/node_modules/meta/index.js:47:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/meta/bin/meta:8:15)
    at Module._compile (node:internal/modules/cjs/loader:1112:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:834:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

Expected behavior

  • it should find npm-search bin file
  • it should print out the usage same as when calling meta-search directly

resolve

because find-module-bin does not look for a bin dir within either npm prefix -g or npm bin -g the bin file for meta search isn't found

root@8e6eb90be27e:/# npm prefix -g
/usr/local
root@8e6eb90be27e:/# npm bin -g
/usr/local/bin
root@8e6eb90be27e:/# which meta-search
/usr/local/bin/meta-search

symlinking it into one of the dir's it is checking, resolves the issue

root@8e6eb90be27e:/usr/local/lib/node_modules/meta-search/bin# ln -nfs /usr/local/lib/node_modules/meta-search/bin/meta-search /usr/local/lib/node_modules/.bin/meta-search
root@8e6eb90be27e:/usr/local/lib/node_modules/meta-search/bin# meta search
  meta
  meta Resolving plugins: +0ms
  meta   /usr/local/lib/node_modules/meta-search/bin/node_modules +1ms
  meta   /usr/local/lib/node_modules/meta-search/node_modules +0ms
  meta   /usr/local/lib/node_modules/node_modules +1ms
  meta   /usr/local/lib/node_modules +1ms
  meta     + meta-bump +0ms
  meta     + meta-project +0ms
  meta     + meta-search +0ms
  meta   /usr/local/node_modules +0ms
  meta   /usr/node_modules +0ms
  meta   /node_modules +1ms
  meta   /usr/local/lib/node_modules +268ms
  meta     + meta-bump (skip) +0ms
  meta     + meta-project (skip) +0ms
  meta     + meta-search (skip) +0ms
  meta
  meta Loading plugins: +0ms
  meta   + meta-bump /usr/local/lib/node_modules/meta-bump +0ms
  meta   + meta-project /usr/local/lib/node_modules/meta-project +0ms
  meta   + meta-search /usr/local/lib/node_modules/meta-search +1ms
  meta
  meta Loading core plugins: +3ms
  meta   + meta-git /usr/local/lib/node_modules/meta/node_modules/meta-git +1ms
  meta   + meta-init /usr/local/lib/node_modules/meta/node_modules/meta-init +0ms
  meta   + meta-loop /usr/local/lib/node_modules/meta/node_modules/meta-loop +34ms
  meta   + meta-project (skip) +35ms
  find-module-bin looking for meta-search at /usr/local/lib/node_modules/meta-search/bin/node_modules/.bin/meta-search +0ms
  find-module-bin looking for meta-search at /usr/local/lib/node_modules/meta-search/node_modules/.bin/meta-search +0ms
  find-module-bin looking for meta-search at /usr/local/lib/node_modules/.bin/meta-search +0ms
  find-module-bin found meta-search at /usr/local/lib/node_modules/.bin/meta-search +0ms
Usage: meta-search [options] [command]

Options:
  -h, --help      display help for command

Commands:
  package         Find packages in package.json that match given criteria
  help [command]  display help for command
@jtzero jtzero added the bug label Jun 28, 2022
@jtzero
Copy link
Author

jtzero commented Jul 13, 2022

I would post this in https://github.com/mateodelnorte/find-module-bin however based on the name I'm under assumption it is working as designed, finding the bin under the node_modules.

@jtzero
Copy link
Author

jtzero commented Aug 29, 2022

My mistake, 1. turns out this was a commander issue and 2. it's actually resolved, my version of it was old, apologies.

@jtzero jtzero closed this as completed Aug 29, 2022
@jtzero jtzero changed the title find-module-bin doesn't take in account npm prefix -g or npm bin -g commander is outdated Aug 30, 2022
@jtzero
Copy link
Author

jtzero commented Aug 30, 2022

Actually it turns out this bug exists because commander is old

@jtzero jtzero reopened this Aug 30, 2022
@mateodelnorte
Copy link
Owner

Up for opening a pr?

@patrickleet
Copy link
Collaborator

We have a forked version of commander - @mateodelnorte I know you made this commander fork but I am not clear on what the reason was for that or if the newest version of commander ever resolved this?

https://github.com/mateodelnorte/meta/blob/master/package.json#L55

It's currently 594 commits behind mainline

This branch is 18 commits ahead, 594 commits behind tj:master.

If the mainline version of commander is still not adequate for what we need maybe there's another tool we could replace it with?

@mateodelnorte
Copy link
Owner

Yeah, commander at some point made changes causing default behavior to no longer work. I created a PR to fix it and it went unmerged for ages, long enough for them to completely change their dev ethos around dependencies. Eventually they closed the PR. Unfortunate.

tj/commander.js#604

@patrickleet
Copy link
Collaborator

There was some more conversation about this here in the past as well: #77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants