Skip to content

[BUG] npx won't execute the latest version of a package #5262

Closed
@nullromo

Description

@nullromo

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

I tried running npx ts-node@latest, but npx decided to execute a version of ts-node that is not the latest.

$ rm -rf ~/.npm
$ node --version
v18.7.0
$ npm --version
8.16.0
$ npx ts-node --version
v9.1.1
$ npx ts-node@latest --version
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y
v9.1.1

It even asks me if I want to install version 10.9.1, but then it runs version 9.1.1 anyway 😕

Expected Behavior

I expect npx <package>@latest to always run the latest version of a package.

Similarly, I expect npx <package>@<version> to always run the specified version. For example, npx ts-node@10 should run ts-node version 10

Steps To Reproduce

  1. Update node and npm to the latest versions.
  2. Try running npx ts-node@latest --version.
  3. It runs an older version
  4. Try deleting ~/.npm; same problem.
  5. Try globally uninstalling ts-node; same problem.
  6. Try locally uninstalling ts-node; same problem.

Environment

  • npm: 8.16.0
  • Node.js: 18.7.0
  • OS Name: WSL
; node bin location = /usr/local/bin/node
; node version = v18.7.0
; npm local prefix = /home/kkovacs/oss_97542
; npm version = 8.16.0
; cwd = /home/kkovacs/oss_97542
; HOME = /home/kkovacs
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions