Skip to content

[BUG] binary not exposed with npm updating missing package globally #8896

@line-o

Description

@line-o

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

The documentation for npm update states that it would install missing packages.
When I update package X in global scope, the process returns with exit code 0 and

; npm update --global X

changed 1 package in 635ms

To me this would indicate all necessary steps have been taken in order to run the latest version of the package.
However, The binary that is available when running npm install --global X, however, is not known to my shell.

For this to happen I have to run npm install --global X once. Is that intended behaviour?

Expected Behavior

If the user has to install a package in global scope in order to have access to the binary the package exposes, then I would expect the update command to tell me that the package was missing and therefore the command line script to not have been installed.

Steps To Reproduce

  1. with node 24.10.0 and npm 11.7.0
  2. with a package X that exposes a command line script Y in .bin
  3. Run npm uninstall --global X
  4. Run npm update --global X
  5. attempt to call cli script Y
  6. the command is not found
  7. Run npm install --global X
  8. call Y

Environment

  • npm: 11.7.0
  • Node.js: 24.10.0
  • OS Name: OSX 15.7.2
  • System Model Name:
  • npm config:
; node bin location = /Users/XXX/.asdf/installs/nodejs/24.10.0/bin/node
; node version = v24.10.0
; npm local prefix = /Users/XXX
; npm version = 11.7.0
; cwd = /Users/XXX
; HOME = /Users/XXX

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions