Skip to content

[BUG] npx won't using latest version of package if already run #6179

Closed

Description

@edwardgalligan

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

This is a re-opening of an old issue with npm@7 - documented here: #4108

The final comment in that issue seems to indicate the bug was fixed, but it is currently occurring in npm@9 (so it was either verified incorrectly or has regressed).

Current behaviour is as follows:

# Assume latest version of package-name is 1.0.0
npx package-name # will download & run 1.0.0

# Assume 1.0.1 is released
npx package-name # will run 1.0.0 - fails to update
npx package-name@1.0.1 # will run 1.0.1 - downloads new version
npx package-name # will STILL run 1.0.0 - newly downloaded 1.0.1 seems to have been cached in a separate location?

Expected Behavior

There should be some sane way to get npx to run the latest version of a package without having to specify @version every time.

Environment

  • npm: 9.5.0
  • Node.js: 18.14.0
  • OS Name: Tested on macOS Monterey & Gentoo
  • System Model Name: Macbook Air (Intel) & AMD PC
  • npm config:
//registry.npmjs.org/:_authToken=npm_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    Release 9.xwork is associated with a specific npm 9 release
    on Feb 16, 2023
  2. dabrady commented on Apr 12, 2023

    @dabrady

    My consumers are experiencing the same thing. I've been recommending a one-line usage to my package consumers like this:

    npx --yes -- @me/my-package blah blah

    and occasionally get complaints that "my package documentation is wrong" when, in fact, npx has simply stopped updating its cache at some point (the precise npx version at which the behavior changed is unknown) and so some users are unwittingly stuck on older versions of my package.

    I've been recommending on a case-by-case basis that they start appending @latest to my package name or else formally install it as a dev dependency, but they don't like it when I tell them to change their workflows.

  3. dabrady commented on Apr 20, 2023

    @dabrady

    Amazing, thank you @wraithgar 🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions