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

[BUG] npm i splits command line arguments incorrectly #7684

Closed
2 tasks done
mwaibel-go opened this issue Jul 24, 2024 · 2 comments
Closed
2 tasks done

[BUG] npm i splits command line arguments incorrectly #7684

mwaibel-go opened this issue Jul 24, 2024 · 2 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@mwaibel-go
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When installing a package with a version range, npm installs the package 'undefined' because it parses the command line arguments wrong.

Expected Behavior

When installing a package with a version range, it should install the requested package at one of the requested versions, preferrably the lowest (IMHO), and not install the undefined package.

Steps To Reproduce

$ mkdir npm-repro
$ cd npm-repro
$ npm i typescript@">=2.0.0 <5.0.0" --verbose
npm i typescript@">=2.0.0 <5.0.0" --verbose
npm verbose cli /home/mwaibel/bin/node-v18.20.3-linux-x64/bin/node /home/mwaibel/bin/node-v18.20.3-linux-x64/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verbose title npm i typescript@>=2.0.0 <5.0.0
npm verbose argv "i" "typescript@>=2.0.0" "<5.0.0" "--loglevel" "verbose"

Note in the line above: "i" "typescript@>=2.0.0" "<5.0.0" – the version ranges got separated.

npm verbose logfile logs-max:10 dir:/home/mwaibel/.npm/_logs/2024-07-24T15_01_15_655Z-
npm verbose logfile /home/mwaibel/.npm/_logs/2024-07-24T15_01_15_655Z-debug-0.log
npm http fetch GET 200 https://npm.global-office.de/undefined 97ms (cache revalidated)
npm http fetch GET 200 https://npm.global-office.de/typescript 811ms (cache updated)
npm http fetch GET 200 https://npm.global-office.de/undefined 27ms (cache updated)
npm warn deprecated [email protected]: this package has been deprecated
npm http fetch POST 200 https://npm.global-office.de/-/npm/v1/security/advisories/bulk 256ms
npm http fetch GET 200 https://npm.global-office.de/typescript/-/typescript-5.5.4.tgz 1112ms (cache miss)

added 2 packages, and audited 3 packages in 2s

found 0 vulnerabilities
npm verbose cwd /home/mwaibel/tmp/npm-repro
npm verbose os Linux 5.10.102.1-microsoft-standard-WSL2
npm verbose node v18.20.3
npm verbose npm  v10.8.2
npm verbose exit 0
npm info ok

Environment

  • npm: 10.8.2
  • Node.js: 10.20.3
  • OS Name: Ubuntu (uname -a: Linux MAX-LAPTOP 5.10.102.1-microsoft-standard-WSL2 archive: committable offline dependency archive #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux)
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here
@mwaibel-go mwaibel-go added Bug thing that needs fixing Needs Triage needs review for next steps labels Jul 24, 2024
@milaninfy
Copy link
Contributor

@mwaibel-go
I tried in Mac as well as WSL for both it's installing correctly. Not able to reproduce your case. If possible Could you please provide a full log file? is it happening with other packages ?

~/workarea/rep $ node -v
v18.20.3
~/workarea/rep $ npm -v
10.8.2
~/workarea/rep $ npm i typescript@">=2.0.0 <5.0.0" --ddd
npm verbose cli /Users/milaninfy/.nvm/versions/node/v18.20.3/bin/node /Users/milaninfy/.nvm/versions/node/v18.20.3/bin/npm
npm info using [email protected]
npm info using [email protected]
npm silly config load:file:/Users/milaninfy/.nvm/versions/node/v18.20.3/lib/node_modules/npm/npmrc
npm silly config load:file:/Users/milaninfy/workarea/rep/.npmrc
npm silly config load:file:/Users/milaninfy/.npmrc
npm silly config load:file:/Users/milaninfy/.nvm/versions/node/v18.20.3/etc/npmrc
npm verbose title npm i typescript@>=2.0.0 <5.0.0
npm verbose argv "i" "typescript@>=2.0.0 <5.0.0" "--loglevel" "silly"
npm verbose logfile logs-max:10 dir:/Users/milaninfy/.npm/_logs/2024-07-25T13_37_45_626Z-
npm verbose logfile /Users/milaninfy/.npm/_logs/2024-07-25T13_37_45_626Z-debug-0.log
npm silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
npm silly logfile start cleaning logs, removing 1 files
npm silly logfile done cleaning log files
npm silly idealTree buildDeps
npm silly fetch manifest typescript@>=2.0.0 <5.0.0
npm silly packumentCache full:https://registry.npmjs.org/typescript cache-miss
npm http fetch GET 200 https://registry.npmjs.org/typescript 23ms (cache hit)
npm silly packumentCache full:https://registry.npmjs.org/typescript set size:13026911 disposed:false
npm silly placeDep ROOT [email protected] OK for: [email protected] want: >=2.0.0 <5.0.0
npm silly reify moves {}
npm silly audit bulk request { typescript: [ '4.9.5' ] }
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 306ms
npm silly audit report {}
npm silly ADD node_modules/typescript

added 1 package, and audited 2 packages in 663ms

found 0 vulnerabilities
npm verbose cwd /Users/milaninfy/workarea/rep
npm verbose os Darwin 23.5.0
npm verbose node v18.20.3
npm verbose npm  v10.8.2
npm verbose exit 0
npm info ok
~/workarea/rep $ npm ls
[email protected] /Users/milaninfy/workarea/rep
└── [email protected]

@mwaibel-go
Copy link
Author

I’m sorry for the noise. I had aliased the npm command (wrongly) and forgotten about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

2 participants