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

jsr add and deno add commands should be able to install packages globally with -g or --global CLI flag #213

Closed
arafathusayn opened this issue Mar 6, 2024 · 1 comment

Comments

@arafathusayn
Copy link

Reproduction

$ deno add -g jsr
error: unexpected argument '-g' found

  tip: to pass '-g' as a value, use '-- -g'

Usage: deno add [OPTIONS] <packages>...

For more information, try '--help'.
$ npx jsr add -g jsr
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
node:internal/util/parse_args/parse_args:98
    throw new ERR_PARSE_ARGS_UNKNOWN_OPTION(
    ^

TypeError [ERR_PARSE_ARGS_UNKNOWN_OPTION]: Unknown option '-g'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- "-g"
    at checkOptionUsage (node:internal/util/parse_args/parse_args:98:11)
    at node:internal/util/parse_args/parse_args:360:9
    at Array.forEach (<anonymous>)
    at parseArgs (node:internal/util/parse_args/parse_args:357:3)
    at Object.<anonymous> (/home/codespace/.npm/_npx/91d31d47806d2506/node_modules/jsr/dist/bin.js:116:51)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
  code: 'ERR_PARSE_ARGS_UNKNOWN_OPTION'
}

Node.js v20.11.0
npm notice 
npm notice New minor version of npm available! 10.2.4 -> 10.5.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.0
npm notice Run npm install -g [email protected] to update!
npm notice 
$ npm i -g jsr

added 3 packages in 265ms

1 package is looking for funding
  run `npm fund` for details

$ jsr --version
0.10.0
$ jsr add -g jsr
node:internal/util/parse_args/parse_args:98
    throw new ERR_PARSE_ARGS_UNKNOWN_OPTION(
    ^

TypeError [ERR_PARSE_ARGS_UNKNOWN_OPTION]: Unknown option '-g'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- "-g"
    at checkOptionUsage (node:internal/util/parse_args/parse_args:98:11)
    at node:internal/util/parse_args/parse_args:360:9
    at Array.forEach (<anonymous>)
    at parseArgs (node:internal/util/parse_args/parse_args:357:3)
    at Object.<anonymous> (/usr/local/share/nvm/versions/node/v20.11.0/lib/node_modules/jsr/dist/bin.js:116:51)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
  code: 'ERR_PARSE_ARGS_UNKNOWN_OPTION'
}

Node.js v20.11.0

I hope, the commands are pretty clear to show the intent. A -g or --global flag support will be nice to have.

@lucacasonato
Copy link
Member

Split into jsr-io/jsr-npm#46 and denoland/deno#22769. Thanks!

@github-project-automation github-project-automation bot moved this from Needs Triage to Done in JSR Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants